Compressed PDF
There are a few options that control how PDF files are generated. By default, text and images in a document are compressed. Since InetSoft products only support Zip compression, the generated document requires Acrobat Reader version 3.0 or later. If the PDF file needs to be compatible with earlier versions, the compression can be turned off manually:
pdf.setCompressText(false);
pdf.setCompressImage(false);
Note: The compression needs to be turned off for CJK operating systems. Otherwise some of the binary data will be corrupted in the PDF file.If compression is turned off, you risk the possibility of a large PDF file. This is especially true if you use images or painters in a report.
Font Handling in PDF (Base-14 Fonts)
Another difference in printing a PDF file is the handling of fonts. In PDF, 14 fonts are guaranteed to exist in a viewer. They are called the base14 fonts. The base14 fonts are listed below:
- courier
- courier-bold
- courier-boldoblique
- courier-oblique
- helvetica
- helvetica-bold
- helvetica-boldoblique
- helvetica-oblique
- symbol
- times-bold
- times-bolditalic
- times-italic
- times-roman
- zapfdingbats
In order to ensure maximum portability, the Java font objects are mapped into the base14 fonts when generating PDF files.
Table 8. Default mapping between Java Fonts and Base-14 Fonts
Java Font Name |
Base14 Font Name |
Dialog |
Helvetica |
Dialoginput |
Courier |
Serif |
Times |
SansSerif |
Helvetica |
Monospaced |
Courier |
This mapping can be changed:
pdf.putFontName("dialog", "Times");
By default the PDFPrinter assumes the output page is letter size (8.5 x 11). To change this, set the page size property:
// switch width and height to print in landscape
pdf.setPageSize(11, 8.5);
// or print on A4 paper
pdf.setPageSize(StyleConstants.PAPER_A4);