Print a PDF File on an IBM i Attached Printer (PRINTPDF) Procedure/Function

Index

Schema IQUERY

 PRINTPDF(PDF =>'PDF-file-name-path', 
OUTQ => 'qualified-outq-name',
HOLD => '*NO' | '*YES',
SAVE => '*NO' | '*YES',
COPIES => 1 to 255,
SPLFNAME => 'SPOOLED-file-name',
USRDTA => 'user-data',
OVRPARMS => 'additional OVRPRTF parameters' );

The PRINTPDF Stored Procedure and User Defined Function copies the specified PDF file (stored on the IFS) to the Output Queue with the options specified. If additional Print file options are needed, use the OVRPARMS parameter. to pass any valid OVRPRTF command parameter and value.

PRINTPDF performs a binary copy of the PDF file to the target output queue so that it can be printed as expected on a PDF-compatible printer. This capability was previously available in COZTOOLS as the CPYFRMPDF CL command.

Parameters

PDF

This fully qualified IFS file that contains the PDF document.

OUTQ

The qualified name of the Output Queue where the PDF is sent. The syntax is the same as a CL command, for example: OUTQ=>'QUSRSYS/INVOICES'. If the library is not included in the qualified name, the library list is searched for the OUTQ name.

HOLD

Default: *NO

Controls whether or not the generated SPOOLED file placed onto the Output Queue in a Held status. Valid choices are *YES or the default *NO.

SAVE

Default: *NO

Controls whether or not the generated SPOOLED file saved (remains on the Output Queue) after it is printed. Valid choices are *YES or the default *NO.

COPIES

Default: 1

Controls the number of copies assigned to the generated SPOOLED file when placed onto the Output Queue. Valid choices are 1 to 255 copies.

SPLFNAME

Default: *NO

Controls whether or not the generated SPOOLED file placed onto the Output Queue in a Held status. Valid choices are *YES or the default *NO.

USRDTA

Default: none

Specifies the User Data added to the SPOOLED file attributes when it is created. The default is whatever the system assigned by default to newly created SPOOLED files, but the iQuery interface defaults to blanks.

OVRPARMS

Default: none

If additional OVRPRTF attributes are desired for the created SPOOLED file, you can pass them on this parameter using the same format as the OVRPRTF command itself. The value specified on this parameter is literally passed to the OVRPRTF command run internally by the interface.

Examples

The following copies a signal PDF file named INVOICE.PDF to output queue INVOICE using the iQuery PRINTPDF stored procedure.

exec sql call iQuery.printPDF('/home/edi/invoice.pdf', 'INVOICE');
The following uses the iQuery PRINTPDF Function to copy each PDF file in the folder /home/weborders to the ORDERS output queue.
select iQuery.printPDF( PDF=> path_name, OUTQ=>'ORDERS') 
from table(iQuery.ifspath('/home/weborders/*.pdf')) pdfs;

The IFSPATH UDTF is used to create a list of PDF documents in the IFS folder named /home/weborders. As each file name is returned by the IFSPATH UDTF, it passes the fully qualified PDF file name to the PRINTPDF function which causes that PDF file to be sent to the ORDERS output queue.