How to print to a physical printer after PDF creation
Sometimes you want to send the print job to both a PDF document and a
physical printer. This article will show you how to do just that.
The idea behind the solution is that you use the Run on success
setting to run a program that sends the PDF to a printer.
There are different ways to send the PDF to a printer. The one used here
is the command line tool PDFCMD.EXE found in the program folder of the
printer. It has the following options.
PDFCMD command="merge|printpdf"
Additional parameters for merge operation
-----------------------------------------
output File name of output PDF.
input Input files to merge. Multiple input files must be
separated by a |.
timeout (optional) Maximum timeout in seconds for the merge
to finish. The default is 60 seconds.
pdfprinter (optional) Name of PDF printer used for the operation.
Example:
PDFCMD command=merge output="C:\temp\merged.pdf" input="C:\Temp\A.pdf|C:\Temp\B.pdf|C:\Temp\C.pdf"
Additional parameters for printing PDF documents
------------------------------------------------
input File name of PDF document to print.
pdfprinter (optional) Name of PDF printer used for the operation.
printer (optional) Name of the printer that should receive the print job.
firstpage (optional) First page to print. Default is the first page.
lastpage (optional) Last page to print. Default is the last page.
scaletofit (optional) Scale output to fit (yes|no). Default is yes.
bpp (optional) Bits per pixel. Valid values are 1, 4, 8, 24 (default).
docname (optional) Document name in printer queue.
maxdpi (optional) Maximum DPI resolution to print.
timeout (optional) Maximum timeout in seconds for the print
to finish. The default is 60 seconds
Alternative methods are described under Print a PDF from the Command Line
A description of the Run on success setting can be found in
the list of settings.
We need to specify the newly created PDF as a parameter to PDFCMD.EXE.
This is done using the %1 variable described under the AfterPrintProgram
setting. Our command line will look like this:
"C:\Program Files\bioPDF\PDF Writer\pdfcmd.exe" command=printpdf input="%1" printer="Your physical printer name"
Remember to use the full path of the PDFCMD.EXE program.
Please note that this solution does not work in all situations.
There may be problems if you try to print landscape documents.
In addition, the output is converted to a bitmap and does not keep the vector
format used in PDF. Therefore, you will not get a good result if you try to
send the output to a new PDF printer.
|