Fop
  1. Fop
  2. FOP-1945

[PATCH] Configurable PDF version

    Details

    • Type: Bug Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Component/s: pdf
    • Labels:
      None
    • Environment:
      Operating System: Linux
      Platform: PC
    • External issue ID:
      51385

      Description

      When a PDF is embedded in another PDF via the PDF-as-an-image plugin, there can be problems when the image-PDF is of a higher version than the host-PDF. The first thing we need to apply is version configurability of the PDF document. This patch allows the user to add "<version>1.5</version>" as a child of <renderer mime="application/pdf">. This allows PDF versions to be specified between 1.4-1.7.

      This patch ONLY allows the header of a PDF to be configurable. I should emphasise that it only allows the header specifying the PDF version can be configured.

      1. dynamicversion.patch
        80 kB
        Mehdi Houshmand
      2. pdfconfigurability.patch
        18 kB
        Mehdi Houshmand
      3. pdfconfigurability.patch
        17 kB
        Mehdi Houshmand
      4. pdfversioning.patch
        48 kB
        Mehdi Houshmand

        Issue Links

          Activity

          Hide
          Mehdi Houshmand added a comment -

          Attachment pdfconfigurability.patch has been added with description: Enable configurable PDF versions

          Show
          Mehdi Houshmand added a comment - Attachment pdfconfigurability.patch has been added with description: Enable configurable PDF versions
          Hide
          Glenn Adams added a comment -

          See also my implementation of such an extension as well as additional features as described in:

          http://marc.info/?l=fop-user&m=130017885816296&w=2

          Regards,
          Glenn Adams

          Show
          Glenn Adams added a comment - See also my implementation of such an extension as well as additional features as described in: http://marc.info/?l=fop-user&m=130017885816296&w=2 Regards, Glenn Adams
          Hide
          Mehdi Houshmand added a comment -

          Corrected a few mistakes:
          InvalidParameterException --> IllegalArgumentException
          javadoc in PDFRenderingUtil
          Added VersionTestCase to the TestSuite

          Show
          Mehdi Houshmand added a comment - Corrected a few mistakes: InvalidParameterException --> IllegalArgumentException javadoc in PDFRenderingUtil Added VersionTestCase to the TestSuite
          Hide
          Mehdi Houshmand added a comment -

          Attachment pdfconfigurability.patch has been added with description: corrected some mistakes

          Show
          Mehdi Houshmand added a comment - Attachment pdfconfigurability.patch has been added with description: corrected some mistakes
          Hide
          Mehdi Houshmand added a comment -

          This version allows dynamic versioning such the "<version>" tag enforces a static PDF version (in the header), however, the lack of said tag will use the PDF in the PDF image. This means if you insert a PDF version > 1.4, the version of the PDF created will match it.

          If neither the "<version>" tag is used, nor a PDF-image then the PDF version defaults to 1.4 as before.

          Show
          Mehdi Houshmand added a comment - This version allows dynamic versioning such the "<version>" tag enforces a static PDF version (in the header), however, the lack of said tag will use the PDF in the PDF image. This means if you insert a PDF version > 1.4, the version of the PDF created will match it. If neither the "<version>" tag is used, nor a PDF-image then the PDF version defaults to 1.4 as before.
          Hide
          Mehdi Houshmand added a comment -

          Attachment dynamicversion.patch has been added with description: Dynamic PDF versioning support

          Show
          Mehdi Houshmand added a comment - Attachment dynamicversion.patch has been added with description: Dynamic PDF versioning support
          Hide
          Mehdi Houshmand added a comment -

          Bugfix:
          PDFs < v1.3 threw an IllegalArgumentException if dynamically versioned.

          Show
          Mehdi Houshmand added a comment - Bugfix: PDFs < v1.3 threw an IllegalArgumentException if dynamically versioned.
          Hide
          Mehdi Houshmand added a comment -

          Attachment pdfversioning.patch has been added with description: Dynamic PDF versioning support

          Show
          Mehdi Houshmand added a comment - Attachment pdfversioning.patch has been added with description: Dynamic PDF versioning support
          Hide
          Vincent Hennebert added a comment -

          I needed this patch for my work on PDF Object Streams (in order to make the compression of the structure tree optional), so I undertook to apply it:
          http://svn.apache.org/viewvc?rev=1302518&view=rev

          I updated the test cases to JUnit 4 and made a few other modifications and clean-ups.

          There is something I'm not too sure about regarding the dynamic configuration: If no version element is specified in the config file, FOP will produce 1.4 by default and increase as necessary to accommodate incoming PDF images of higher version. If any version is specified in the config file, then that version will not be allowed to increase.

          On the other hand, if I want to enable 1.5-specific features like the upcoming object streams, I would want to set the version to 1.5 and still expect it to increase as necessary to handle PDF images.

          That said, we may also want this parameter to mean that a certain renderer, with a certain feature set, must be selected, if for example we need to maintain backwards compatibility with downstream products. So in that case we /would/ want the version to be fixed.

          All that doesn't really matter as long as we don't use the PDF Images plug-in. So, in order to allow things to still change in that area, I've removed any mention to dynamic configuration and the plug-in.

          Thanks,
          Vincent

          Show
          Vincent Hennebert added a comment - I needed this patch for my work on PDF Object Streams (in order to make the compression of the structure tree optional), so I undertook to apply it: http://svn.apache.org/viewvc?rev=1302518&view=rev I updated the test cases to JUnit 4 and made a few other modifications and clean-ups. There is something I'm not too sure about regarding the dynamic configuration: If no version element is specified in the config file, FOP will produce 1.4 by default and increase as necessary to accommodate incoming PDF images of higher version. If any version is specified in the config file, then that version will not be allowed to increase. On the other hand, if I want to enable 1.5-specific features like the upcoming object streams, I would want to set the version to 1.5 and still expect it to increase as necessary to handle PDF images. That said, we may also want this parameter to mean that a certain renderer, with a certain feature set, must be selected, if for example we need to maintain backwards compatibility with downstream products. So in that case we /would/ want the version to be fixed. All that doesn't really matter as long as we don't use the PDF Images plug-in. So, in order to allow things to still change in that area, I've removed any mention to dynamic configuration and the plug-in. Thanks, Vincent

            People

            • Assignee:
              fop-dev
              Reporter:
              Mehdi Houshmand
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development