[
https://issues.apache.org/jira/browse/PDFBOX-5170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Lehmkühler resolved PDFBOX-5170.
----------------------------------------
Resolution: Fixed
COSWriter tries to reuse object keys to avoid too many unused object numbers
within the cross reference table. This works fine for new pdfs and existing
pdfs which are loaded, manipulated and saved using "save" as COSWriter "knows"
the highest object number from the loaded pdf so that it is easy to avoid
reusing an already used object number.
It gets complicated when is comes to incremental updates and signing. Such pdfs
are written in several steps and COSWriter doesn't have all information it
needs to avoid overlapping object numbers. I've simply disabled the
reusage-part in such cases as a sort of workaround. Furthermore I've realized
that compressed object streams don't work for the incremental/signing part of
such pdfs so that I've explicitly disabled compression (it was already disabled
implicitly by not setting any value for {{compressParameters}}) Saying that,
there seems to be a some room for improvements, but that is another story.
> Compression creates issue with Page structure
> ---------------------------------------------
>
> Key: PDFBOX-5170
> URL: https://issues.apache.org/jira/browse/PDFBOX-5170
> Project: PDFBox
> Issue Type: Bug
> Components: Writing
> Affects Versions: 3.0.0 PDFBox
> Reporter: Daniel Persson
> Assignee: Andreas Lehmkühler
> Priority: Minor
> Fix For: 3.0.0 PDFBox
>
>
>
> Hi Team.
>
> PDFBox version 3.0.0-RC1
> pdftoppm version 21.04.0
> mupdf-gl version 1.18.0
>
> This might be an unusual issue but might needs to be checked. The simple code
> below creates a PDF that can't be viewed with Poppler because of "error:
> malformed page tree"
> {code:java}
> PDDocument testPdf = Loader.loadPDF(new File("input.pdf"));
> testPdf.save(new File("output.pdf"));
> testPdf.close();
> PDDocument testPdf2 = Loader.loadPDF(new File("input.pdf"));
> testPdf2.save(new File("output2.pdf"), CompressParameters.NO_COMPRESSION);
> testPdf2.close();
> {code}
> This is not a content issue because all PDFs from the same producer have the
> same problem, I've just picked an example.
> Best regards
> Daniel
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]