PDF PRTOPEN Notes


9.6A

The syntax of the PRTOPEN instruction is as follows:

 

[label] PRTOPEN [{window};]{pfile},{device},{jobname}[,{options}...]

Note the following:

  1. If the {device} for the PRTOPEN is specified with the 'pdf:', the {jobname} parameter can be null or it can contain the fully qualified path and PDF file name where the Advanced Print operations are to be written. If the {jobname} is null, a file selection dialog is presented to allow specification of the PDF file name used for output. Optionally, an {options} keyword named 'PDFNAME={svarslit}' can specify a PDF output file name. If the PDFNAME keyword parameter is used, the PDFNAME file name is used for the PDF output and the {jobname} is expected to contain a print job name.

  2. The basic PDF output is written requiring a PDF reader version 1.4 or later.

  3. A new {options} keyword named 'FLAGS={dnumnvar}' has been added for a PRTOPEN instruction that specifies a numeric value that is a bit mask to invoke specialized behaviors for the PDF implementation.

  4. FLAGS={dnumnvar}
    Bit mask value to invoke specialized behaviors for the PDF support implemented for advanced printing. The bit mask values are defined as follows:

     

    PDF_FLAGS_NO_COMPRESSION EQU 1
    Do not compress data in the PDF output file.

     

    PDF_FLAGS_EMBED_FONTS EQU 2
    Embed fonts in the PDF output file. When built-in fonts named Times, Helvetica, and Courier are being used in a PRTPAGE *FONT control, these fonts are not embedded the PDF output file. Only, non-built-in fonts are embedded in the PDF output file. The default behavior for the PDF output is to automatically embed fonts.

     

    PDF_FLAGS_SUB_GENFONTS EQU 4
    When this bit is turned on, the PDF support detects when a Windows font with a specific name is used in a PRTPAGE and then a PDF built-in generic font is substituted and put into the PDF output file. If the 'PDF_FLAGS_SUB_WINFONTS' flag bit value is not used, the default behavior of the runtimes is the same as when the 'PDF_FLAGS_SUB_GENFONTS' bit value is turn on. See the following table:
     
    Windows Font in PRTPAGE
    PDF Output Font
    Times New Roman
    Times
    Arial
    Helvetica
    Courier New
    Courier

     

    PDF_FLAGS_SUB_WINFONTS EQU 8
    When this bit is turned on, the PDF support detects when a PDF built-in font with a specific name is used in a PRTPAGE and then a Windows font is substituted and put into the PDF output file. If this 'PDF_FLAGS_SUB_WINFONTS' flag bit value is not used, the default behavior of the runtimes is the same as when the 'PDF_FLAGS_SUB_GENFONTS' bit value is turn on. See the following table:
     
    PDF Built-in Font in PRTPAGE
    PDF Output Font
    Times
    Times New Roman
    Helvetica
    Arial
    Courier
    Courier New

     

    PDF_FLAGS_NOSUB_FONTS EQU 12
    When both the 'PDF_FLAGS_SUB_GENFONTS' and 'PDF_FLAGS_SUB_WINFONTS' bit values are specified at the same time, the PDF support allows both Windows fonts and generic fonts to be output into a PDF file. When using this FLAGS setting, any generic fonts specified in a PL/B program are changed to be a Windows font when the PDF file is generated via a PRINT PREVIEW or a PRTPLAY using a spool file. Also, using this FLAGS setting, there is no font substitution when generating a PDF file directly if PRINT PREVIEW and PRTPLAY are not being used.
     
    PDF_FLAGS_ZERO_DEF_MARGINS EQU 16

    When this bit is turned on, the top and left margins are set to zero when generating the PDF output. This bit mask value can be used when the PLB application is attempting to create a Sunbelt PDF output consistent with a 3rd party PDF writer that does not use the top and left margins.

     

    PDF_FLAGS_NO_EMBED_FONTS EQU 32

    When this bit is turned on, fonts are not embedded in the PDF output. This bit mask value overrides the default action where fonts are embedded into the PDF output.

     

    PDF_FLAGS_ALWAYS_PDF_OUTPUT EQU 64

    When this bit is turned on, exiting the PRINT Preview window always generates a PDF output when the PRINT Preview has the PDF output as an optional output and the PRINT Preview CLOSE button is selected. This bit ONLY takes affect if the PRINT Preview window CLOSE button is selected. Therefore, if a PRINT Preview has both the 'ToPrint' and 'ToPDF' buttons specified, this bit has NO affect if the 'ToPrint' button is selected.

     

    PDF_FLAGS_WIN_ANSI_ENCODING EQU 128

    When this bit is turned on, the PDF output is set to enable Windows ANSI encoding when national characters with character values greater than 0x7F are used. This Windows ANSI encoding causes PDF readers to properly interpret and present the national characters.

     

    PDF_FLAGS_NO_JPEG_COMP EQU 1024 (0x400)
    When this bit is turned on, the Sunbelt 'pdf:' output does not generate compressed 'jpeg' images when outputing a PICT object to the PDF file. Turning this bit on causes the PCT object image to be output using BMP image data.
     
    PDF_FLAGS_USE_SUBFONTS EQU 2048 (0x0800)

    When this bit is turned on, fonts are rendered as font subsets into the Sunbelt PDF output. This bit only affects the Sunbelt PDF output and is not used for any other advanced printer devices. When this bit is turned on, the font subsets are always embedded for the Sunbelt PDF output. (9.7C)

     
    PRT_FLAGS_UNICODE EQU 4096 (0x1000)

    When this bit is turned on, the Unicode support is enabled and used for advanced printing output. In this case, the printer output device can be a Windows print device or the Sunbelt PDF output device (pdf:). Also the Unicode support applies to the print preview output If this bit is turned on and the Sunbelt PDF output device is used, the font subsets are automatically used for the PDF output. (9.7C)

     

  5. A new {options} keyword named 'PDFNAME={svarslit}' has been added for a PRTOPEN instruction that specifies a fully qualified path and file name used to write the PDF output:

  6. PDFNAME={svarslit}
    This optional keyword parameter specifies a path and file name to write the PDF output. When the keyword parameter is used, it takes precedence and its file name is used for PDF output instead of the {jobname} string. The implementation of this keyword is intended to give a PL/B application the flexibility to specify both a {jobname} and a PDF output file name when using an advanced Print Preview that has both a PRINT and PDF output button available.
  7. The PRTOPEN instruction for PDF output supports the PL/B file name formats including the keyword substitution for Datapoint and '$' macro formats. This enhanced file name support applies to the 'PDFNAME' option and the {jobname} parameter when the {device} is directed to the 'pdf:' output device.

  8. If the 'PDFNAME' file name uses either the Datapoint or the '$' macro format and it includes a SUNDM ip address, the PLBENV and PLBVOL keywords are only found/resolved by the PL/B runtime executing a program. In this case, the SUNDM does not resolve any PLBENV or PLBVOL keywords.

Examples of a PRTOPEN to a PDF file:

 

     PRTOPEN Prt,"@pdf:","c:\temp\test.pdf"

In this case, the Print Preview is being used and the {jobname} specifies the PDF output file. In addition, the Print Preview has a single output button titled 'To PDF'. The Print Preview can only output to a PDF file. Also, when this PL/B statement is executed by a PLBSERVE Application Server, the UI output is always shown at the PLBCLIENT client workstation. Otherwise, all other PL/B runtimes that execute this case generates the PDF output relative to the system where the runtime is executing.

 

     PRTOPEN Prt,"pdf:","c:\temp\test.pdf"

In this case, a PDF file specified in the {jobname} is written directly. When this statement is executed by a PL/B runtime, the PDF file is located on the system where the runtime is executed. Therefore, when this statement is executed for a PLBSERVE Application Server, the PDF output file is located at the server system where PLBSERVE is executing.

 

     PRTOPEN Prt,"!pdf:","c:\temp\test.pdf"

In this case, a PDF file specified in the {jobname} is written directly. When this statement is executed by a PLBSERVE Application Server, the PDF file output is located at the PLBCLIENT client workstation. Otherwise, the other PL/B runtimes ignore the '!' character and the PDF output is located relative to the system where runtime is executing.

 

     PRTOPEN Prt,"@HP-Printer","My Job",PDFNAME="c:\temp\test.pdf"

In this case, the Print Preview is being used and the PDFNAME keyword specifies the PDF output file. The Print Preview has two output buttons with one titled 'To PDF' and the other button titled 'PRINT'. The end user has the option of either printing to the printer device or of outputting to a PDF file.

 

 

See Also: PDF Support, Printer Instructions



PL/B Language Reference Supported Print Controls PDF PRTPLAY Notes