This section shows a way to create a PDF file from the payload of a workflow via a command call on the IBM i platform.
In this case this workflow has been setup:
Overview:
The workflow above expects an input spooled file and it will merge the input spooled file with the variable template, that is specified on the command. The resulting PDF data stream will be stored in the payload of the workflow and returned to the calling command.
The workflow above can be called by this CL program:
PGM
DSPJOBLOG OUTPUT(*PRINT)
IFORMNG2/NG2CMD COMMAND(PDF) FILE(QPJOBLOG) +
SPLNBR(*LAST) +
TOSTMF('/iformng2/result.pdf') +
TEMPLATE('generic.ift')
ENDPGM
This program generates a joblog as a spooled file and calls the NG2CMD command in order to merge it with the template, generic.ift. The resulting PDF file is stored in the path, /iformng2/result.pdf.