Save an IBM i spooled file as a PDF: CPYSPLF WSCST(*PDF) and Navigator
Turn IBM i printer output into a PDF with CPYSPLF TOSTMF and WSCST(*PDF), or Export in IBM Navigator for i, then download the file from the IFS.
A report on IBM i is a spooled file: printer output waiting in an output queue. To keep it, mail it or read it on another device, you can convert it to a PDF on IBM i and download the PDF.
On the command line: CPYSPLF
CPYSPLF (Copy Spooled File) can write a spooled file to a stream file in the IFS and convert it on the way:
CPYSPLF FILE(QSYSPRT) JOB(123456/JSMITH/DSP01) SPLNBR(*LAST)
TOFILE(*TOSTMF) TOSTMF('/home/jsmith/report.pdf')
WSCST(*PDF) STMFOPT(*REPLACE)
FILE,JOBandSPLNBRpick the spooled file. Find them withWRKSPLF; a spooled file's attributes show its job and file number.TOFILE(*TOSTMF)sends the output to the IFS path inTOSTMF.WSCST(*PDF)turns the output into PDF.STMFOPT(*REPLACE)overwrites a file of the same name. WithSTMFOPT(*NONE), the command fails if the file exists.
Two conditions:
- The spooled file's device type (
DEVTYPE) must be*SCSor*AFPDS. - IBM Transform Services for i (licensed program 5770-TS1) must be installed for the PDF conversion.
For plain text instead of PDF, WSCST(QSYS/QWPDEFAULT) converts an SCS spooled file to ASCII text.
In IBM Navigator for i
Under Basic Operations, open Printer Output, select the file, and choose Export as then PDF. The Infoprint Server option needs an Infoprint Server licence and can send the PDF to an output queue, the IFS or e-mail. Transform Services is the other route.
Getting the PDF onto your device
The PDF is now a file in the IFS. If the system runs SSH, you can download it with SFTP. See SFTP, and in the app, SFTP file browser.
Related
- Delete spooled files and clear an output queue on IBM i
- IBM i objects, libraries and the IFS
- IBM i CL basics
- SFTP