Bug 51385 - [PATCH] Configurable PDF version
Summary: [PATCH] Configurable PDF version
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: 1.0
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks: 52060
  Show dependency tree
 
Reported: 2011-06-16 13:58 UTC by Mehdi Houshmand
Modified: 2012-03-28 08:43 UTC (History)
0 users



Attachments
Enable configurable PDF versions (17.01 KB, patch)
2011-06-16 13:58 UTC, Mehdi Houshmand
Details | Diff
corrected some mistakes (17.52 KB, patch)
2011-06-16 16:03 UTC, Mehdi Houshmand
Details | Diff
Dynamic PDF versioning support (80.21 KB, patch)
2011-07-05 08:00 UTC, Mehdi Houshmand
Details | Diff
Dynamic PDF versioning support (48.18 KB, patch)
2011-08-03 08:47 UTC, Mehdi Houshmand
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mehdi Houshmand 2011-06-16 13:58:11 UTC
Created attachment 27163 [details]
Enable configurable PDF versions

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.
Comment 1 Glenn Adams 2011-06-16 14:05:41 UTC
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
Comment 2 Mehdi Houshmand 2011-06-16 16:03:16 UTC
Created attachment 27164 [details]
corrected some mistakes

Corrected a few mistakes:
InvalidParameterException --> IllegalArgumentException
javadoc in PDFRenderingUtil
Added VersionTestCase to the TestSuite
Comment 3 Mehdi Houshmand 2011-07-05 08:00:27 UTC
Created attachment 27253 [details]
Dynamic PDF versioning support

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.
Comment 4 Mehdi Houshmand 2011-08-03 08:47:58 UTC
Created attachment 27344 [details]
Dynamic PDF versioning support

Bugfix:
PDFs < v1.3 threw an IllegalArgumentException if dynamically versioned.
Comment 5 Vincent Hennebert 2012-03-19 16:32:34 UTC
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