Pdf 2 Ps Outq

This page was created by request of ZendCon/LUG members that wanted a IBM i only way to transform PDF documents to PostScript and then send to a IBM i OUTQ (printer).

Software Prerequisites

  • IBM PASE for i (SS1, Option 33)
  • The RPM package manager needs to be installed in PASE
       Note: Use the instructions found here: Open Source Binaries
  • Use the wwwinstall.sh script downloaded as part of the RPM package manager install instructions to download and install the following groups of pre-compiled Open Source binaries for AIX:
     call qp2term
     > cd /QOpenSys/download
     > wwwinstall.sh GetBase
     > wwwinstall.sh GetXbase
     > wwwinstall.sh GetWbase
     > wwwinstall.sh GetXbase2
     > wwwinstall.sh GetPostScript
     > wwwinstall.sh GetGhostScript
     > wwwinstall.sh GetPdf
    Note: IBM toolkit version of ghostscript is very old (not so great), but perzl site has a newer version that works better for PDFs http://www.perzl.org/aix/. The wwwupdatepdf2ps.sh script updates IBM version to a modern level from site perzl.
  • Use the wwwupdatepdf2ps.sh script to update ghostscript
    Click Attach:wwwupdatepdf2ps.sh PASE script to download.
     > ftp this script to IFS file wwwupdatepdf2ps.sh (binary ftp)
     call qp2term
     > cd /QOpenSys/download
     > chmod +x wwwupdatepdf2ps.sh
     Update ghostscript: 
     call qp2term
     > cd /QOpenSys/download
     > wwwupdatepdf2ps.sh GetPdf2Ps
  • install pdf2ps2outq.sh script
    Click Attach:pdf2ps2outq.sh PASE script to download.
     Install (example IFS /home/adc, but any dir will do):
     > ftp this script to IFS file pdf2ps2outq.sh (binary ftp)
     call qp2term
     > cd /home/adc
     > chmod +x pdf2ps2outq.sh
     Note: /home/adc is just an example directory.
     update 2012-10-16 - @Alan Seiden - pdf2ps2outq.sh bug fix last parm changed from OUTQ to OFLE
                         QSH="qsh cmd('cat $2 | Rfile -wbQ -c \"$OVR\" $OUTQ')"
                         -- corrected to ---
                         QSH="qsh cmd('cat $2 | Rfile -wbQ -c \"$OVR\" $OFLE')"


The pdf2ps2outq.sh PASE script will transform PDF (input.pdf) to PostScript (output.ps), then copy PostScript to OUTQ (qgpl/qprint). Feel free to modify pdf2ps2outq.sh to fit your needs (change outq, etc.).

Usage (example IFS /home/adc, but any dir will do):

  • 1) interactive PASE
call qp2term
> cd /home/adc
> pdf2ps2outq.sh input.pdf output.ps
  • 2) interactive command
QSH CMD('/home/adc/pdf2ps2outq.sh /home/adc/input.pdf /home/adc/output.ps')
  • 3) batch command:
SBMJOB CMD(QSH CMD('/home/adc/pdf2ps2outq.sh /home/adc/input.pdf /home/adc/output.ps'))

Note from user CL *USERASCII …

Thank you for your effort, it all worked for me. Except one minor issue.

“cat” command.

For me, when I didn’t use “cat -c” (note the switch “-c”) and then I printed the generated “*USERASCII spooled file” on the real hardware paper printer (Postscript ASCII stream) it printed plain garbage text on the paper. I had the issue only when I run it from iSeries CL command: QSH cmd(‘cat …’). If the “cat” command was run directly from qsh shell then all is OK even without “-c” switch.

Switch “-c” on iSeries PASE “cat” command means: no translate/conversion of “text/binary” data. Best regards

Author Tony “Ranger” Cairns