You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Alexios Giotis <al...@gmail.com> on 2011/09/12 23:28:06 UTC

Adding or not a referenced font in the PDF document's font resources

Hi, 

I recently had a tricky problem with some PDF files created by FOP 1.0 that could be viewed but not printed on big production printers. It turned out that the problem was a missing font from the resource list. Specifically, the internal font name "F1" was not listed to be the base font Helvetica. The Adobe Acrobat preflight clearly showed the message:  Missing font "F1" and in the PDF there were entries like:

BT
/F1 0 Tf
1 0 0 -1 0 0 Tm ET
...


but no

<<
/Font <<
  /F1 547 0 R
  /F24 551 0 R
....

The cause was my SAX filter that dynamically changes the FOP intermediate format from
<font family="sans-serif" style="normal" weight="400" variant="normal" color="#000000"/>
<text x="0" y="0">Some text to be replaced</text>
to

<font family="sans-serif" style="normal" weight="400" variant="normal" color="#000000"/>
<text x="0" y="0"></text>


I did not search for any other way to reproduce this case, but by looking in the method:
org.apache.fop.pdf.PDFResources.addFonts(PDFDocument, FontInfo)

it seems to me (not a PDF expert !) that the line with the if statement below should be deleted.
if (font.hadMappingOperations()) 

By deleting, it means that if a font is referenced, it should be added to the document's font resources, even if there were no mapping operations (some text really written). Otherwise, there can be cases where the PDF can't be printed.

What do you say ?

If you agree, will you fix it ? Should I submit a small patch ?


Greetings,
Alexios Giotis