I'm working on a report generator that uses iText to generate PDF
files. The content of the individual pages is composed by first
printing a template, which is read from another PDF using
PdfWriter.getImportedPage() followed by PdfContentByte.addTemplate();
then, the actual data are printed on top of the template using the
usual PdfContentByte methods. Repeat for each page.
All this works fine, except for one thing: the final reports consist
of about 80% font data. Simply opening and then saving them in Acrobat
will shrink them considerably, sometimes by more than 50%. Apparently,
there are a lot of duplicated fonts in the generated PDFs, but I don't
understand how they get there.
The templates I use for the individual pages do not contain any
embedded fonts; when I use a font in the code that populates the data,
I'll create it with the BaseFont.EMBEDDED flag, but from the Javadocs,
it is my understanding that those fonts should only get embedded once.
Could it be the process of reading the templates that is causing the
same set of fonts to be embedded over and over?
Thanks for any insights!
||2/23/2007 10:29:45 PM