Peter Hansson created FOP-2681:

             Summary: PDF file is 50x too big
                 Key: FOP-2681
             Project: FOP
          Issue Type: Bug
          Components: renderer/pdf
    Affects Versions: trunk
            Reporter: Peter Hansson

When embedding SVG images (such as a logo) in a {{fo:static-content}} the SVG 
instructions (as converted to Postscript) gets inlined on _every_ page of the 
generated PDF. Thus, the image doesn't exist only once in the PDF (as it 
should), but once for every page of the PDF.

This balloons the size of the PDF.

Test case is attached.

To reproduce:
The test case has 50 pages. Execute the test with {{-pdf test-50p.pdf}}.
Now edit {{svg-test-case.xsl} and reduce the body content to only 1 page. 
Execute again, but this time with {{-pdf test-1p.pdf}}. Now compare size of the 
two PDFs. They should be almost same size because there's virtually no body 
text on each page so it should matter very little in size if the PDF is 1 page 
or 50 pages. Yet you'll notice that the PDF with the 50 pages is almost 50 
times as large as the PDF with only one page. The reason is of course that the 
SVG gets copied into each and every page rather than simply existing once in 
the PDF as a common resource and then _referenced_ on each page.

For raster graphics images this seems to be done correctly, meaning the image 
doesn't get duplicated with each page. So it seems to be a problem related to 
vector graphics.

But raster graphics is not an option. They are simply too ugly (doesn't scale, 
of course).

This message was sent by Atlassian JIRA

Reply via email to