Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2681

PDF file is 50x too big

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: trunk
    • Fix Version/s: None
    • Component/s: renderer/pdf
    • Labels:
      None

      Description

      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:

      1. The test case has 50 pages. Execute the test with -pdf test-50p.pdf.
      2. Now edit svg-test-case.xsl and reduce the body content to only 1 page.
      3. Execute again, but this time with -pdf test-1p.pdf.
      4. 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).

        Attachments

        1. SVG-test-case.zip
          3 kB
          phansson

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              phansson phansson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: