Using Print Display Formats: PDF, PS

In this section:

Reference:

PDF (Adobe Acrobat Portable Document Format) is most often used to distribute and share electronic documents through the web. It is especially useful if you want a report to maintain its presentation and layout regardless of a browser or printer type. For details, see Using PDF Display Format.

PS (PostScript format), a print-oriented page description language, is most often used to send a report directly to a printer. While used less frequently as an online display format, you can display PS report output on your monitor before printing it. For details, see Using PostScript (PS) Display Format.

FOCUS generates a PDF or PS document from scratch. In order to do so, it must physically embed all the objects it displays or prints, including images and fonts, in the document itself.

When you execute a report request and specify PDF or PS as your format, FOCUS retrieves the data and begins to format the report. Fonts and images specified in the StyleSheet must be available to create the output file. FOCUS reads the font information from font files and embeds that information in the document.

To ensure that FOCUS can locate the required information, you must define and map it in the following files:


Top of page

x
Reference: Required Files and DDNAMES

When you produce a PostScript or PDF report, you need the following files:

Name

Purpose

z/OS

StyleSheet files. You can create them with a text editor (see Styling Reports).

Define the styles in reports.

Any member of the PDS allocated to ddname FOCSTYLE. Alternatively, you can specify the StyleSheet in your report request and eliminate the need for a separate StyleSheet file.

Adobe Font Metrics (AFM) files (supplied with FOCUS).

Define the measurements of characters for PostScript and PDF output.

Member names start with PS. Allocated to ddname ERRORS.

Font location file (supplied with FOCUS).

Maps font names to the Font Metrics files.

Members FONTMAP and FONTUSER in the PDS allocated to ddname ERRORS.

Output files. You create these with a HOLD, SAVE, or SET command.

Contain the formatted output.

DDNAME is HOLD or the AS name assigned in the HOLD command.

Note that if you add fonts, you also need PFA or PFB files for those fonts.



x
Using PDF Display Format

You can display a report as a PDF document. PDF (Adobe Acrobat Portable Document Format) supports most StyleSheet attributes, allowing for full report formatting. The wide range of StyleSheet features supported for PDF are described throughout this documentation.

PDF prints and displays a document consistently, regardless of the application software, hardware, and operating system used to create or display the document.

The report opens in Adobe Acrobat or Acrobat Reader within a Web browser. To display a PDF report, a computer must have Adobe Acrobat Reader installed. For free downloads of Acrobat Reader, go to http://www.adobe.com.

Limit: Adobe Acrobat PDF format limits the number of pages, hyperlinks, and images in a document. For information about what limits this creates for a FOCUS report in PDF format, see Saving and Reusing Your Report Output.

Other print-oriented display formats. You can also display a report as a PostScript document. For more information, see Using PostScript (PS) Display Format.


Top of page

x
Using PostScript (PS) Display Format

You can display a report as a PostScript document. PostScript (format PS) is a print-oriented page description language. As a display format, it may be helpful if you wish to see report output on your monitor before printing it using PostScript.

To display a PostScript report, a computer must have a third-party PostScript application installed, such as GSview (a graphical interface for Ghostscript).

If you are sending a PS report to a printer from FOCUS, you can select the size of the paper on which to print the output. The PostScript code that is generated works on PS printers that support Language Level 2 or above. It is ignored, without harmful effects, on Level 1 printers. This capability is only supported for the PostScript format.

Other print-oriented display formats. You can also display a report as a PDF document. For more information, see Using PDF Display Format.


Top of page

x
FOCUS Font Support

In this section:

Reference:

You can add and configure PostScript Type 1 fonts to significantly expand your options for displaying and printing PS and PDF reports, beyond those provided by the basic set of fonts distributed with Adobe Reader. Thousands of PostScript fonts are available to make your reports more stylish and useful, including some that support symbols and bar codes.

The font map files for Type 1 fonts are stored as XML files (fontmap.xml and fontuser.xml). All font mappings in these files are used for both PDF and PostScript report output.



x
Reference: Support for the Symbol Font

To use the Symbol font, specify font=symbol in your FOCUS StyleSheet:



x
How FOCUS Uses Type 1 Fonts

FOCUS generates a PDF or PS document from scratch. In order to do that, it must physically embed all the objects it displays or prints, including images and fonts, in the document itself.

When you execute a report and specify one of these formats as your display format, FOCUS retrieves the data and begins to format the report. Fonts and images specified in the StyleSheet must be available to FOCUS to create the output file. It reads the font information from the font files and embeds that information into the document. The font itself is stored in a PDS allocated in your FOCUS JCL or CLIST.

To ensure that FOCUS can locate the required information, you must define and map it in the following files:

There are two files FOCUS uses for mapping fonts, both in an XML-based format:

The user font map should be in a data set concatenated in front of the distributed ERRORS libraries so it is searched before the default font map. Then font definitions in the user map will override definitions of the same font in the default map.

You can also use a variety of utilities to convert Windows True Type fonts (such as Arial and Tahoma) into Type 1 fonts. Verify that you are licensed for this type of font use. Then, after you convert them, you can define and map these fonts for use by FOCUS.

One such utility is TTF2PT1.

For information about the Windows version, go to:

http://gnuwin32.sourceforge.net/packages/ttf2pt1.htm



x
Adding PostScript Type 1 Fonts for PS and PDF Formats

This section describes how to add PostScript type 1 fonts to the fontuser.xml file.



x
Procedure: How to Configure Type 1 PostScript Fonts on z/OS

After you have located the font files you wish to add, you can configure FOCUS to use one or more Type 1 fonts.

  1. Copy the AFM (font metrics) file into the PDS allocated to DDNAME ERRORS in the FOCUS JCL or CLIST. You can copy this file from another machine using FTP in standard ASCII (text) mode. The member name of the AFM file in this PDS will match the metricsfile value in the font map file.

    Note: If the Windows font file names contain underscore characters or are longer than eight characters, you must rename them, since these are not valid for z/OS member names.

  2. You can use either PFB (binary) fonts or PFA (ASCII) fonts:
    • If you are using PFB (binary) fonts, create a partitioned data set, put the PFB file in it (for example, using FTP in BINARY mode), and allocate this data set to DDNAME PFB.

      This PDS should be created with the following DCB attributes:

      RECFM: VB    LRECL: 1028    BLKSIZE: 27998

      The member name in this PDS should match the fontfile name in the font map file.

      If you copy the PFB font file into the PDS using FTP, you must use BINARY mode. The member name of the PFB file in this PDS will match the fontfile value in the font map file.

    • If you are using PFA (ASCII) font files, create a PDS (separate from the one you use for PFB fonts), put the PFA file in it (for example, using FTP in regular, ASCII mode), and allocate this data set to DDNAME PFA. This PDS should be created with the following DCB attributes:
      RECFM: VB    LRECL: 2044    BLKSIZE: 27998

      The member name in this PDS should match the fontfile value in the font map file. Note that you can use PFB and PFA files simultaneously. The fonttype attribute in the font map file (PFB or PFA) tells FOCUS which PDS to search for the specified member name.

  3. The user font map file is in member FONTUSER in a data set allocated to DDNAME ERRORS. Using a text editor, add your font definition to the user font map using the syntax described in How to Add Fonts to the Font Map.


x
Syntax: How to Add Fonts to the Font Map

The Type 1 PostScript fonts used with the PostScript and PDF output formats use separate font files for each variant of the font: normal, bold, italic, and bold-italic. This grouping of related fonts is called a font family. The example will use the family name Garamond.

The XML font map syntax uses two XML tags, <family> and <font>, to represent this structure. For example:

<family name="garamond">
  <font style="normal"
        metricsfile="gdrg" fontfile="gdrg" fonttype="PFB" />
  <font style="bold"
        metricsfile="gdb"  fontfile="gdb" fonttype="PFB" />
  <font style="italic"
        metricsfile="gdi"  fontfile="gdi" fonttype="PFB" />
  <font style="bold+italic"
        metricsfile="gdbi" fontfile="gdbi" fonttype="PFB" />
</family>

The basics of the XML syntax are:

  • Tag names (such as family and font) and attribute names (such as style or metricsfile) must be in lowercase. Attribute values, such as font file names, are case-insensitive.
  • Attribute values (the text after the "=" sign) must be in double quotes (for example, "bold")
  • Elements that have no explicit end-tag must end with />. (For example, the family tag has the closing tag </family>, but the font tag has no closing tag, so it ends with />.)
  • Comments are enclosed in special delimiters:
    <!-- This is a comment -->
  • Line breaks may be placed between attribute-value pairs.

A more complete description of XML syntax can be found here:

http://en.wikipedia.org/wiki/Xml

The family element

The family element specifies the name of a font family. This family name, specified in the name attribute of the family element, is the name by which the font will be referenced in a StyleSheet. It corresponds to the value of the FONT attribute in the StyleSheet. The end-tag </family> closes the family element, and any number of additional family elements may follow.

Font family names should be composed of letters (A-Z, a-z), digits, and limited special characters: minus sign (-), underscore (_), and blank, and have a maximum length of 40 characters. Since the font name is only a reference to a mapping in the font map, it does not need to be related to the actual name of the font (which FOCUS obtains from the mapped AFM file) or the font's file name.

Font elements

Nested within each family element are one or more font elements that specify the font files for each font in the family. For example, there may be one font element for the font Garamond Regular (normal), one for Garamond Italic (italic). Since a font element has no child elements, it is closed with "/>".

The actual name of the font as used in the PDF or PostScript document is taken from the font metric file.

Fonts defined in the user font file (fontuser.xml) can override default font definitions in fontmap.xml. Thus, you should be careful to choose family names that do not conflict with existing definitions, unless you actually wish to override these definitions (which should generally not be done).

Each font element contains the following attributes:

  • style: This attribute specifies the style of the font and corresponds to the STYLE attribute in the StyleSheet. The allowed values are "normal", "bold", "italic", and "bold+italic". For example, the font defined in the following bold italic font element:
    <font style="bold+italic" metricsfile="gdbi" fontfile="gdbi" fonttype="PFB" />

    could be referenced in the StyleSheet like this:

    TYPE=REPORT, FONT=GARAMOND, STYLE=BOLD+ITALIC, $

    Although most fonts have a font file for each of the four styles, some specialized fonts such as bar code fonts might only have a single style (usually "normal"). Only the styles that exist for a particular font need to be specified in the font map file.

    The actual names of the fonts may vary. Some fonts may be called "oblique" rather than "italic", or "heavy" rather than "bold". However, the font map and StyleSheet always use the keywords "normal", "bold", "italic" and "bold+italic".

  • metricsfile: This attribute specifies the name of the Adobe Font Metrics (AFM) file that provides the measurements of the font. You should only use the base name of the file (for example, "gdrg", not "gdrg.afm"). On z/OS, the name refers to a member in a PDS allocated to ERRORS. For information about file locations, see How to Configure Type 1 PostScript Fonts on z/OS.

    File names should be composed of letters and numbers, and should not contain blanks.

  • fonttype: This attribute specifies the type of the font file. The allowed values are "PFA" or "PFB".
  • fontfile: This attribute specifies the name of the PFB or PFA file that contains the font itself. As with metricsfile, the value specifies only the base file name (the fonttype attribute specifies the type). On Windows and UNIX, the file is assumed to have the extension .pfb for binary (PFB) font files or .pfa for ASCII (PFA) font files, and should reside in the same directory as the AFM files (wfs/etc). On z/OS with PDS deployment, the name refers to a member in the appropriate PDS.

Additional items of XML syntax include the XML header on the first line of the file and the <fontmap> and <when> elements that enclose all of the family elements. These tags are essential to the XML font map syntax and should not be modified. In particular, the <when> tag allows the same font mappings to be used for both PDF and PostScript reports.

The following is a complete example of a user font map:

<?xml version="1.0" encoding="UTF-8" ?>
<!-- Example of a user font map file with two font families. -->
<fontmap version="1">
    <when format="PDF PS">
        <family name="garamond">
            <font style="normal"
                  metricsfile="gdrg" fontfile="gdrg" fonttype="PFB" />
            <font style="bold"
                  metricsfile="gdb"  fontfile="gdb"  fonttype="PFB" />
            <font style="italic"
                  metricsfile="gdi"  fontfile="gdi"  fonttype="PFB" />
            <font style="bold+italic"
                  metricsfile="gdbi" fontfile="gdbi" fonttype="PFB" />
        </family>
        <!-- This font only has a "normal" style, others omitted. -->
        <family name="ocra">
            <font style="normal"
                  metricsfile="ocra" fontfile="ocra" fonttype="PFB" />
        </family>
    </when>
</fontmap>


Example: FOCUS StyleSheet Declaration

Once the font map files have been set up, the newly mapped fonts can be used in a FOCUS StyleSheet. For example, to use the Garamond fonts:

ON TABLE SET STYLE *
type=report, font=garamond, size=12, $
type=title, font=garamond, style=bold, color=blue, $
ENDSTYLE

Since the style attribute has been omitted for the report font in the StyleSheet, it defaults to normal. Attributes such as size and color can also be applied.



x
Reference: Editing the Font Map File

There is a byte order mark (BOM) at the beginning of the user font map file (fontuser.xml), which must be preserved for this file to be read correctly.

If you are using a Unicode-aware editor such as Notepad on Windows to edit the file, the BOM will not be visible, but you can preserve it by making sure that you select an encoding of "UTF-8" in the Save-As dialog. In most other editors, such as the ISPF editor under z/OS, the BOM will display as three or four strange-looking characters at the beginning of the file. As long as you do not delete or modify these characters, the BOM will be preserved.



x
Reference: The FOCUS Default Font Map

Since the user font map is searched before the FOCUS default font map, font definitions in the user font map file will override mappings of the same font in the default font map file. Since you usually would not want to override existing font mappings, you can check which font names are already used by FOCUS by examining the default font map file.

On z/OS it is in the FONTMAP member of a partitioned data set allocated to DDNAME ERRORS. Unlike the user font map file, this file has separate sections containing definitions for PS, PDF and DHTML formats. (The DHTML mappings are used for the DHTML and PowerPoint output formats, which do not support user-added fonts.)

Since the font mappings in the default font map file are for fonts that are already assumed to exist on the user's machines (for example, built-in Adobe Reader fonts, standard PostScript printer fonts, or standard Windows fonts), they do not reference font files, only font metrics files. Fonts provided by the user should reference both font files and metrics files.

AFM files for the default fonts are also members of a PDS allocated to DDNAME ERRORS.


Top of page

x
Creating a Compound PDF or PS Reports

How to:

Compound reports combine multiple reports into a single PDF or PS file. The first PDF or PS report defines the format for the concatenated report, enabling you to intersperse intermediate reports of other formats into one encompassing report. Using compound reports, you can gather data from different data sources and combine reports into one governing report that runs each request and concatenates the output into a single PDF or PS file. You can also embed image files in a compound report.



x
Syntax: How to Create a Compound PDF or PS Report

For a compound report that may contain different report types, use the syntax

SET COMPOUND= {OPEN|CLOSE} [NOBREAK]

or

ON TABLE SET COMPOUND {OPEN|CLOSE}

Note that when you are using this syntax, you must also include the following code to identify the display format of each of the reports to be concatenated:

ON TABLE {HOLD|SAVE} [AS name] FORMAT formatname

If all of the reports in the compound set are of the same type, either PDF or PS, you can use the following, more compact, syntax

ON TABLE {HOLD|SAVE} [AS name] FORMAT {PDF|PS} {OPEN|CLOSE} [NOBREAK]

where:

name
Is the name of the generated file. The name is taken from the first request in the compound report. If no name is specified in the first report, the name HOLD is used.
OPEN
Is specified with the first report, and begins the concatenation process. A report that contains the OPEN attribute must be PDF or PS format.
CLOSE
Is specified with the last report, and ends the concatenation process.
NOBREAK
Is an optional phrase that suppresses page breaks. By default, each report is displayed on a separate page.

You can use NOBREAK selectively in a request to control which reports are displayed on the same page.

Note:



Example: Creating a Compound PDF Report

The following illustrates how to combine three separate PDF reports into one by creating a compound report. Notice that:

Note that in this example, all reports are set to PDF format. However, when you create a compound report, only the first report must be in either PDF or PS format. Subsequent reports can be in any styled format.

Report 1:

SET PAGE-NUM=OFF
TABLE FILE GGSALES
HEADING
"Sales Report"
" "
SUM DOLLARS
BY PRODUCT
ON TABLE SET STYLE *
TYPE=HEADING, SIZE=14,STYLE=BOLD, $
TYPE=REPORT, FONT=ARIAL,SIZE=10,$
ENDSTYLE
ON TABLE HOLD FORMAT PDF OPEN NOBREAK
END

Report 2:

TABLE FILE GGSALES
HEADING
"Budget Report"
" "
SUM BUDDOLLARS
BY PRODUCT
ON TABLE SET STYLE *
TYPE=HEADING, SIZE=14, STYLE=BOLD, $
TYPE=REPORT, FONT=ARIAL,SIZE=10,$
ENDSTYLE
ON TABLE HOLD FORMAT PDF NOBREAK
END

Report 3:

TABLE FILE GGSALES
HEADING
"Quota Report"
" "
SUM BUDDOLLARS DOLLARS AND COMPUTE
QUOTAPCT/D7.2 = DOLLARS/BUDDOLLARS * 100; AS '% of,Quota'
BY PRODUCT
ON TABLE SET STYLE *
TYPE=HEADING, SIZE=14,STYLE=BOLD,$
TYPE=REPORT, FONT=ARIAL,SIZE=10,$
ENDSTYLE
  ON TABLE HOLD FORMAT PDF CLOSE
END

The output displays as a PDF report. Because the syntax for reports 1 and 2 contain the NOBREAK command, the three reports appear on a single page. (Without NOBREAK, each report displays on a separate page.)


Top of page

x
Displaying An and AnV Fields With Line Breaks

How to:

Using StyleSheet attributes, you can display An (character) and AnV (varchar) fields that contain line breaks on multiple lines in a PDF or PostScript report. Line breaks can be based on line feeds, carriage returns, or a combination of both. If you do not add these StyleSheet attributes, all line feed and carriage return formatting within these fields will be ignored.



x
Syntax: How to Display An and AnV Fields Containing Line Breaks on Multiple Lines
TYPE=REPORT,LINEBREAK='type',$

where:

REPORT

Is the required component for the LINEBREAK attribute.

'type'

Specifies that line breaks will be inserted in a report based on the following:

LF inserts a line break after each line-feed character found in all An and AnV fields.

CR inserts a line break after each carriage-return character found in all An and AnV fields.

LFCR inserts a line break after each combination of a line-feed character followed by a carriage-return character found in all An and AnV fields.

CRLF inserts a line break after each combination of a carriage-return character followed by a line-feed character found in all An and AnV fields.

Note: The report output must be formatted as PDF or PostScript.



Example: Displaying an Alphanumeric Field With Line Breaks in a PDF Report

The following request defines an alphanumeric named ANLB field with a semi-colon in the middle. The CTRAN function then replaces the semi-colon with a carriage return character and stores this string in a field named ANLBC. On the report output, this field displays on two lines:

DEFINE FILE EMPLOYEE                                
ANLB/A40 ='THIS IS AN An FIELD;WITH A LINE BREAK.'; 
ANLBC/A40 = CTRAN(40, ANLB, 094, 013  , ANLBC);     
END                                                 
TABLE FILE EMPLOYEE                                 
PRINT LAST_NAME ANLBC                                        
WHERE LAST_NAME EQ 'BLACKWOOD' 
ON TABLE HOLD FORMAT PDF                 
ON TABLE SET STYLE *                                
TYPE=REPORT,LINEBREAK='CR',$                        
ENDSTYLE                                            
END                                                 

The output is:

LAST_NAME
ANLBC
BLACKWOOD
THIS IS AN An FIELD
WITH A LINE BREAK.


Example: Using an Alphanumeric Field With a LIne Break in a Subfoot

The following request defines an alphanumeric named ANLB field with a semi-colon in the middle. The CTRAN function then replaces the semi-colon with a carriage return character and stores this string in a field named ANLBC. In the subfoot, this field displays on two lines:

DEFINE FILE EMPLOYEE                                
ANLB/A40 ='THIS IS AN An FIELD;WITH A LINE BREAK.'; 
ANLBC/A40 = CTRAN(40, ANLB, 094, 013  , ANLBC);     
END                                                 
TABLE FILE EMPLOYEE                                 
PRINT FIRST_NAME                                    
BY LAST_NAME                                        
WHERE LAST_NAME EQ 'BLACKWOOD'                      
ON LAST_NAME SUBFOOT                                
  " "                                               
  " <ANLBC "                                        
ON TABLE HOLD FORMAT PDF                 
ON TABLE SET STYLE *                                
TYPE=REPORT,LINEBREAK='CR',$                        
ENDSTYLE                                            
END                                                 

The output is:

LAST_NAME
FIRST_NAME
BLACKWOOD
ROSEMARIE
  THIS IS AN An FIELD
  WITH A LINE BREAK.
 



x
Creating PDF Files on z/OS for Use With UNIX Systems

How to:

Reference:

PDF files created with HOLD FORMAT PDF present a challenge if you work in a z/OS environment and use UNIX-based systems as the server for Adobe or as an intermediate transfer point.

The end of each PDF file has a table containing the byte offset, including line termination characters, of each PDF object in the file. The offsets indicate that each line is terminated by two characters, a carriage return and a line feed, which is the standard Windows text file format. However, records in a UNIX text file are terminated by one character, a line feed only. When using default settings, the offsets in a PDF file will be incorrect, causing an error when Acrobat attempts to open the file. If the file is then transferred in BINARY mode to Windows, it cannot be opened in Acrobat for Windows, as the carriage-return character was not inserted.

One solution has been to transfer the file to the UNIX system in text mode and then transfer in text mode to the Windows system, as the carriage return is added by the transfer facility when transferring to Windows.

If that is not possible or desirable, you can use the SET PDFLINETERM=SPACE command to facilitate binary transfer to Windows from an ASCII-based UNIX system. This command causes an extra space character to be appended to each record of the PDF output file. This extra space acts as a placeholder for the expected carriage return character and makes the object offsets in the file correct when it is transferred from z/OS to a UNIX system. This enables a UNIX server to open a PDF file in that environment.

Note: A text mode transfer is always required when transferring a text file from a mainframe to any other environment (Windows, ASCII Unix, or EBCDIC Unix).



x
Syntax: How to Specify Line Termination Characters When Creating a PDF File

In a profile, a FOCEXEC, or from the command line, issue the following command:

SET PDFLINETERM={STANDARD|SPACE}

In a TABLE request, issue the following command

ON TABLE SET PDFLINETERM {STANDARD|SPACE}

where:

STANDARD
Creates a PDF file without any extra characters. This file will be a valid PDF file if transferred in text mode to a Windows machine, but not to a UNIX machine. If subsequently transferred from a UNIX machine to a Windows machine in text mode, it will be a valid PDF file on the Windows machine.
SPACE
Creates a PDF file with an extra space character appended to each record. This file will be a valid PDF file if transferred in text mode to a UNIX machine, but not to a Windows machine. If subsequently transferred from an ASCII UNIX machine to a Windows machine in binary mode, it will be a valid PDF file on the Windows machine.


x
Reference: Required PDFLINETERM Settings Based on Environment

The following chart will assist you in determining the correct setting to use, based on your environment:

Transferring from z/OS to:

SET PDFLINETERM=

EBCDIC UNIX (text transfer)

SPACE

ASCII UNIX (text transfer)

SPACE

ASCII UNIX (text); then to Windows (binary)

SPACE

UNIX (text); then to Windows (text)

STANDARD

Directly to Windows (text)

STANDARD


Information Builders