Updated: 10/23/2020, 1:48:27 PM
Created: 10/23/2020, 1:48:27 PM
Last Updated By: Mike Street
Read Time: 4 minute(s)
Tags: spooler spooltopdf pdfspooler spool2pdf pdf jpdf
# Document Scope
This document covers the use of the jBASE Spool2pdf utility and is intended to be read as a companion to the Spooler documentation.
# Prerequisites / Installation
On Windows, the DOSPrinter command is installed and visible system wide via the PATH environment variable. DOSPrinter is a commercial product not affiliated with jBASE.
Ensure jBASE is installed, appropriately licensed, and the jBASE spooler has been created with SP-NEWTAB.
Download the spool2pdf.zip package and use the appropriate distribution for your platform. The package contains:
- jPDF.b – This program is the device driver that creates the PDF files from spooler output
- ParseOptions.b– This function is used by the jPDF driver to parse the options
- jspform_pdf – This is the Form Type file for use on Linux/UNIX platforms
- jspform_winpdf– This is the Form Type file for use on Windows
- Extract the contents of jPDF.tar.gz (Linux/AIX) or jPDF.zip (Windows):
gzip -d jPDF.tar.gz tar -xvf jPDF.tar
(or use an application like WinZip or 7-zip)
5. Compile and catalog jPDF.b into a ‘bin’ directory visible system wide to the PATH environment variable. Compile and catalog ParseOptions.b into a ‘lib’ directory visible system wide to the JBCOBJECTLIST environment variable.
6. If the platform is Linux or AIX then place the jspform_pdf form-type file in the $JBCRELEASEDIR/config directory. If the platform is Windows then place the jspform_winpdf form-type file in the %JBCRELEASEDIR%\config directory. The reason for the different form types is due to the different end-of-line characters.
# Create the Form Queue
SP-CREATE queue_name PROG jPDF [Options]
jPDF -o[output directory] -q[queuename] -e[\“enscript options\”] -p[\“ps2pdf options\”]
jPDF -o[output directory] -q[queuename] -d[DOSPrinter options]
- output directory - the full path of the base directory where the PDF files will be saved. If output directory is not specified then print jobs will go to $JBCSPOOLERDIR or $JBCDATADIR/jbase_data/jspooler, in that order. $JBCDATADIR defaults to $JBCRELEASEDIR.
The full directory structure is: <output directory> / <account> / <job number>.pdf
- queuename- alternative name to formqueuename. If not specified then this is the name of actual form queue
- enscript options - the entire option string must be wrapped in double-quotes and the double-quotes must be escaped. There is no limit to the order or number of options. Use the “xxx=yyyy” version where available.
- ps2pdf options - the entire option string must be wrapped in double-quotes and the double-quotes must be escaped (see examples under Usage). There is no limit to the order or number of options. Use the “xxx=yyyy” version where available.
- DOSPrinter options – All available options are described on the DOSPrinter website. It is not recommended to wrap multiple options in quotes (see example under 'usage' ).
Options can be placed in any order.
Spaces can be used freely within the option string for clarity.
Each option should only be specified once, otherwise only he last one is used.
On Linux/AIX the work directory is /tmp. On Windows it is %TEMP% or C:\temp, which ever is defined first.
Examples of use are as :
SP-CREATE JPDF PROG jPDF SP-TYPE JPDF pdf
SP-CREATE JPDF PROG jPDF.exe SP-TYPE JPDF winpdf
This example uses all of the default options and values and assumes that the jPDF executable is visible via PATH. The UNIX/Linux enscript -B (no header) option is included by default. The Windows example uses DOSPrinter to create the PDF.
SP-CREATE INSTRUCTIONS PROG /home/bin/jPDF –o /home/documents –q PDF –e \”--header=Hello, world! –borders --lines-per-page=42 --pass-through\” SP-TYPE INSTRUCTIONS pdf
This example creates a formqueue named INSTRUCTIONS and uses the full path to the jPDF driver. The output-directory is; /home/documents, and the queuename is being overridden with the -q option, so PDFs will subsequently be stored in the /home/documents/PDF/accountname directory (where accountname is the user’s login name). Note the use of the xxxx=yyyy versions of the enscript options and that the double-quote marks have been ‘escaped’ as those are meta-characters that have special meaning to the operating system.
SP-CREATE TODO PROG jPDF.exe –d/CPI17 /LAND SP-DEVICE TODO winpdf
This example uses DOSPrinter to create the PDF. The -d options set the Characters Per Inch to Condensed (17.14cpi) and the orientation to Landscape. Note that the options are not enclosed in quotes.
The jBASE SP-DEVICE command can be used to change the original device specifications of an existing form queue, e.g.
SP-DEVICE INSTRUCTIONS PROG jPDF [new options]
See Also: Spooler.