Add job to printqueue - print locally - printqueue

I'm wondering how to create a print job from an application and send it to the printqueue of a printserver in C#. I then want to be able to retrieve and print the job on the server from another computer on a local printer when I want to.
My problem is that you have to assign a printername to a printqueue. But this shouldn't be necessary while the job is supposed to be printed locally.
I hope I make myself clear!

I'm not sure where are you going with this. PrintQueue is a queue of a printer. Not just some kind of waiting queue where you can add and remove jobs. If you put a job into a PrintQueue, it's going to be printed with the printer, associated with that PrintQueue.
Also please note that putting a job into queue means that document being printed is going to be converted to printer's driver-specific instructions. So, event if it would be possible to extract job from queue, you would not be able to print it on a different printer.

Related

Looking for a scripting to connect to a server and purge a printers print queue?

Trying to get something like this to work against servers running 2008 and above.
Dim objPrinter As Object
objPrinter = GetObject(“winmgmts://servername/PR53”)
objPrinter.Purge
Running that on server 2003 quickly purges print queue for that printer. Running that against servers running 2008 and above receive cannot create activeX.
Trying to find WMI code to accomplish the same thing. We have software running all over the US and when Zebra printers come back from repair sometimes there may be 1000 print jobs in queue. Looking for something I can include in an existing program that I wrote that configures the networking for the device before use. Would be nice while reconfiguring device the program could call routine that would purge the queue. I will know the printer ID and the server name.
preferarbly the script would be VB.
Trying to register ActiveX on all our current customers server's is not feasible.
Thanks

How to display a status depending on the data flow position

Consider for example this modified Simple TCP sample program:
How can I display the current state of the program like
Wait for Connection
Connected
Connection terminated
on the frontpanel, depending on where the "data flow" currently is.
The easiest way to do this is to place a string indicator on your front panel and write messages to a local variable of this indicator at each point where you want to see a status update.
You need to keep in mind how LabVIEW dataflow works: code will execute as soon as the data it depends on becomes available. Sometimes you can use existing structures to enforce this - for example, if you put a string constant inside your loop and wire it to a local variable terminal outside the loop, the write will only happen after the loop exits. Sometimes you may need to enforce that dataflow artificially, for example by placing your operation inside a sequence frame and connecting a wire to the border of the sequence: then what's inside the sequence will only happen after data arrives on that wire. (This is about the only thing you should use a sequence for!)
This method is not guaranteed to be deterministic, but it's usually good enough for giving a simple status indication to the user.
A better version of the above would be to send the status messages on a queue or notifier which you read, and update the status indicator, in a separate loop. The queue and notifier write functions have error terminals which can help you to enforce sequence. A notifier is like the local variable in that you will only see the most recent update; a queue keeps all the data you write to it in the right order so would be more suitable if you want to log all the updates to a scrolling list or log file. With this solution you could add more features: for example the read loop could add a timestamp in front of each message so you could see how recent it was.
A really good solution to this general problem is to use a design pattern based on a state machine. Now your program flow is clearly organised into different states and it's very easy to add in functionality like sending a different message from each state. There are good examples and project templates for these design patterns included with recent versions of LabVIEW.
You should be able to find more information on any of the terms in bold in the LabVIEW help or on the NI website.

Auto sending Email

I would need something that would automatically run request to API at specified time, to retrieve list of email address and then sent those email at specified time. Any ideas how this could be done?
Many thanks.
You can do this with the help of cron Jobs. Follow the following steps to set cron jobs.
Go to your control panel search for Cron Jobs
In new window set you cron timing and path of your cron file.
Now server will run your file automatically at set time.
If you have any query feel free to ask.

Read Output From A Running Process Realtime (Command Prompt)

I have been researching for an answer for my question for a long while using Google and changing what words I use in-case I find my answer, I have had no luck.
What I want is to the read the output from a process in real-time, not when it finishes the command it has been given. I have a command that I use which doesn't end unless the user ends it manually, closes the form or an error occurs. So every timer interval I would like to read the output from the command prompt (process).
I use background workers to start the process so it doesn't interfere with the form if that is any help.
Thanks in advance.

coldfusion - cfprint issues with large spool files

I am using cfprint from ColdFusion to print multiple PDFs from a directory. The problem I am having is that when the files are spooled to the printer the size of the file dramatically increases and slows down everything. The file in the folder is 125K and when it is in the printer spool it increases up to 15.7MB. Here is the ColdFusion code:
<cfprint
source="[FILELOCATION]/[FILE].pdf"
color="yes"
printer="[printer name]">
The files will eventually print but it can take upwards of 15-20 minutes. Does anyone have any solutions for this issue? I have tried with both CF generated PDFs and ones that I have created from scratch. Thanks
Queue up two to five at a time. Pause to allow processing. Mark them as printed, move or delete them, move to the next batch...Time this out yourself to see how much time you need to allow. That way you don't compound a bunch of work for the server and create a bottleneck on your CF server.
If you are just doing this with one server consider using a secondary low priority server and run a developer edition fully paid for EULA compliant registered version of Coldfusion (or Railo) and dedicate that server for just printing so your other server can do useful things.
Edit
So the OP has a Coldfusion print bottleneck. In your server that does the printing (same as your CF server I assume?) and IF this is a windows server (not sure your server version), there is print queue folder. Provided you have access to this folder, you can do a few things. You can create a method for FTP-ing your files to this folder (or copy if it is the same server). The printer will queue up the job and off it goes. You can do some functions like check the print queue for file count. If the file count is greater zero, check back in 15 minutes. If the count is zero, copy over a few more files.
You be creating a scheduled task in your CFAdmin and automate. There is a getprinterInfo() so you can check if the printer is off line and do other things like check for another printer somewhere else if you need to reroute print jobs. You can also set up several print servers and attach printers to them and hit several print servers and check print queue folders.
The magic is endless, goal is to offset work to something other than your Coldfusion server.
So to recap:
Seperate concerns by not doing cfprint
Create escape routes to other priters if you can.
If you must use coldfusion then queue up a dedicated Coldfusion server for print management stuff.
Use getPrinterInfo() and dump out things to see what you can use, trap etc.
Ben forta has a tool that can check for several printers, consider incorperating this.
Next use cfftp (or cffile if you are on the same server) provided you have access and copy files to print queue folders, doing no cfprint at all.
Here is a link on print spool stuff (another link in the doc shows you how you can change the spool location).
When it is over you are going to be the coldfusion print master with escape routes and checks and everything.