Print Progress and Managing the Print Queue: Difference between revisions
(Created page with "== The Print Progress Screen == Open Petra has a class called TFrmPrintProgress that handles the placing of documents into the print queue. It displays a small progress windo...") |
(No difference)
|
Revision as of 13:35, 30 November 2015
The Print Progress Screen
Open Petra has a class called TFrmPrintProgress that handles the placing of documents into the print queue.
It displays a small progress window with Status text, a progress bar and two buttons
- Pause Printing
- Abort Print Job
If the user clicks the Pause button the text (and action) changes to Resume Printing.
It is very important that printed documents come off the printer in a specific order, especially if a separate print run is used to print the labels or envelopes using the same partner extract. It would potentially be very bad to run off Year End gift receipts for partners and then put them in the wrong envelopes!
The Print Progress window can be created and shown and then its main method called - which is named 'StartPrintingAsync' and takes either 2 or 4 parameters
- a reference to the caller form, a path to a folder
- a reference to the caller form, a printer name, a path to a folder, an array of file names in the folder
In the first case the Print Dialog is displayed to set the target printer. In the second case the dialog should have been already displayed so the caller passes the printer name to the method.
As the method name suggests the task, which is described below, runs asynchronously. The caller form must implement the single method defined in IPrintProgress - AsyncPrintingCompleted(RunWorkerCompletedEventArgs). However it is even possible for the caller form to be closed while the print run is continuing. The caller typically will disable certain controls so that the client cannot start another print run while the first one is still running. (Imaging interleaving documents from two print runs together!).
The background worker code has been written to ensure that documents are strictly placed into the print queue one at a time. In addition to waiting for the process that talks to the print driver to finish there is a further additional short delay to ensure that Office (or Notepad) has truly finished. This delay is set at 2 seconds which should be plenty long enough. This default value means that we will put 25-30 documents per minute into the print queue, which is probably faster than many printers will print the documents and thereby remove them from the queue. However the fastest laser printers may achieve this speed and therefore always be waiting for a new document to print. This printer delay can be altered in the client configuration file - even on a printer by printer basis - so offices can 'experiment' with shortening this two second delay to, say, one second for these super-fast printers.
There is no particular value in putting documents into the print queue significantly quicker than they can be removed since the client can work on other Open Petra screens while this progress screen is monitoring progress, particularly so if the print run is hundreds or thousands of documents.
To be very clear... when printing there are two things going on. There is putting documents into the print queue (which we can now pause/resume or abort) and there is actually sending the document to the printer from the queue. A client can pause/resume/abort this process by opening the specific printer window in the Windows system tray. Once a document is in the print queue OpenPetra has no further control over it. We rely on the print spooler to print the document sin the order they were placed in the queue (Windows keeps a note of the time they each arrive).