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.
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
Created attachment 27164 [details] corrected some mistakes Corrected a few mistakes: InvalidParameterException --> IllegalArgumentException javadoc in PDFRenderingUtil Added VersionTestCase to the TestSuite
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.
Created attachment 27344 [details] Dynamic PDF versioning support Bugfix: PDFs < v1.3 threw an IllegalArgumentException if dynamically versioned.
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