PDF

PDF is a file format created by Adobe, initially to provide a standard form for storing and editing printed publishable documents. Because documents in .pdf format can easily be seen and printed by users on a variety of computer and platform types, they are very common on the World Wide Web.

The renderer currently generate PDF files that comply with the Adobe PDF 1.7 specification. As the PDF format is backwards compatible, this means that the files can be accessed using Adobe Acrobat version 9.0 or later and other PDF viewers and utilities that accept PDF 1.7 or later.

The PDF render properties are shown in figure Figure 5.5, “PDF Options”.

Figure 5.5. PDF Options

PDF Options

Use iText API mode

This flag enables use of the iText API mode which addresses an issue with JDK 1.6 output. By default JDK 1.6 outputs text as glyphs which results in higher accuracy of output, but much bigger files. The accuracy is due to the conversion to vector graphics within the engine, instead of within the PDF viewer. A benefit of the default JDK 1.6 behaviour is that no fonts need to be embedded.

However, where reports need to be transmitted across the network or archived, the increase in file size (which may be a factor of ten or more) can be excessive. By enabling API mode, the renderer outputs characters instead of glyphs to produce smaller files. This may cause some minor discrepancies in the report, for example a line of text may be fractionally longer or shorter because it is now the PDF viewer that chooses the best font match. In API mode, fonts can be embedded to ensure the viewer chooses an appropriate font.

Create blank page on empty file

Create blank page on empty file option allows empty file such as 0 bytes size file to be rendered into the pdf output successfully with blank page created. However, if the option is disabled, 0 bytes file size will fail to render into pdf output.

Format

Image: When this option is selected then in the rendered PDF document each page will be a page-sized image. This results in bigger files, but requires no embedded fonts.

Grey Scale: When this is selected then the output will be displayed in shades of grey instead of color which will make the file size smaller. If you will only be printing in black and white then it might be useful to reduce memory usage.

Dots per inch: Dots per inch indicates the desired resolution of the rendered image - larger values mean increased sharpness, but bigger file size.

Encryption

When this check box is selected the PDF file is encrypted with user and owner passwords. Encryption allows owners to control certain functions such as printing the file, copying and pasting from the file. So only when this check box is selected we can set the flag values. If the owner password is left blank, the system will generate a random password - effectively preventing anyone from changing the access options.

The encryption strength either 40 bits or 128 bits is selected from the combo box. The 40-bit strength is the standard one. You can increase a document's cryptographic strength by using 128-bit security.

Flags

With encryption enabled, a PDF viewer will determine the operations that can be performed on the document based on the list of flags.

CJK Font Mapping

The PDF specification defines 14 built-in fonts. If you use fonts that are not part of the specification they can be embedded in the report (subject to font licensing) or the glyphs can be rendered as vectors, removing the need for the font, but making selection impossible.

CJK Fonts can be very large, so embedding the glyphs or even the font itself results in large files. The next page of the PDF Render Wizard allows font names to be substituted, retaining small files, as long as the CJK fonts are available on the reader devices. The wizard page is shown in Figure 5.6, “PDF CJK Mapping”.

Figure 5.6. PDF CJK Mapping

PDF CJK Mapping

The CJK Mapping File is a text file, which contains a substitution on each line. For example:

Serif=STSong-Light
SansSerif=MSung-Light

You can create this mapping file as a text file in the repository, so that many reports can share it and so you can easily deploy it to the Repertoire Server if necessary. Once the mapping file is chosen, all text in the report that use Serif font will be written to PDF as STSong-Light.

Note

The font metrics used in placement of the text will still use Serif, so it is important to choose substitutions with closely matching font metrics. Adobe does not allow the free use of their CJK fonts which prevents use of the actual CJK font metrics.

Common CJK font encodings are defined in /config/EREngine-config.xml. You can add extra definitions here if you need additional fonts, but will need to restart the tool for them to be read.

Font Mapping

Physical fonts need to be installed in locations known to Java Runtime Environment.

Users can add the physical fonts that use a supported font technology by installing them either in the jre/lib/fonts directory within the J2RE, or by installing them in a way supported by the host operating system (copying them into the Fonts folder of windows, using the pkgadd command in solaris, etc).

After you have installed the Windows true type font and PostScript type 1 fonts onto your JVM, you will have to do the font mapping in Elixir Report Designer to load the right fonts for report generation.

When you start the Report the Font types will be loaded along with it.

In the config folder of Repertoire, there is a "EREngine-config.xml" file which controls font mapping. The Java system property "elixirtech.fonts.path" is assigned the value of the absolute path of the font directory.

Table 5.1. Java AWT font types on Window platform.

Java Font AWT Familyfont.properties-mapped in JDK 1.6PDF Type1 Font Family mapped
DialogArialHelvetica Type1 - Actual font : Arial MT, true type
DialogInputCourierCourier Type 1 - Actual font : Courier, Type 1
MonospacedCourierCourier Type 1 - Actual font : Courier, Type 1
SansSerifArialHelvetica Type1 - Actual font : Arial MT, true type
SerifTimes New RomanTimes Type 1 - Actual font : TimeNewRomanPSMT,truetype

Table 5.2. Type1 PDF fonts with encoding Cp1252

Window Font Face NamePDF Type1 Font Name
Courier NewCourier
Courier New BoldCourier-Bold
Courier New ItalicCourier-Oblique
Courier New Bold ItalicCourier-BoldOblique
Times New RomanTimes-Roman
Times New Roman BoldTimes-Bold
Times New Roman ItalicTimes-Italic
Times New Roman Bold ItalicTimes-BoldItalic

Table 5.3. List of PDF Type 1 font names

PDF Type 1 Font Name (14)
Courier
Courier-Bold
Courier-Oblique
Courier-BoldOblique
Times-Roman
Times-Bold
Times-Italic
Times-BoldItalic
Helvetica
Helvetica-Bold
Helvetica-Oblique
Helvetica-BoldOblique
Symbol
ZapfDingbats

Table 5.4. List of possible encodings

Identity-H
Identity-V
Cp1250
Cp1252
Cp1257
MacRoman

Note

Many fonts are released under a license that prevents embedding. You must ensure that you are allowed to embed the fonts you use.

Font Mixing

Font mixing is a feature that allows you to select the appropriate fonts that contain the glyphs needed to render text correctly. The fonts are checked in order until the character is found. You may use this feature with end user defined characters (EUDC) where the font name maybe MyEUDC. Before embedding the new font, you have to define this font name in the pdf-font-mapping, which is in the EREngine-config.xml file under the /Repertoire/config directory. Replace "MyEUDC" with the actual font name.

<map-encoding logical-font-name="MyEUDC" encoding="Identity-H"/>

You can only use this feature with iText API enabled and enabling this feature will turn off PDF optimization and affect performance. Use only when needed.

Uncomment the following scripts in the EREngine-config.xml file. Replace "MyEUDC" with the actual font name.

<!-- pdf-font-selector>
<font logical-font-name="MyEUDC"/>
</pdf-font-selector -->

You might have to replace "C:\\WINDOWS\\Fonts" with the actual system fonts path in the EREngine-config.xml file.

<property name="elixirtech.fonts.path" value="C:\\WINDOWS\\Fonts"/>