[
https://issues.apache.org/jira/browse/PDFBOX-5381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17498574#comment-17498574
]
Tilman Hausherr edited comment on PDFBOX-5381 at 2/27/22, 12:04 PM:
--------------------------------------------------------------------
It's also on several other output files in PDFBox
reactor/examples/target/test-output , including some that has incrmental saving
without signing. The whole thing started when I investigated
https://stackoverflow.com/questions/71267471/ and ran signing with the trunk on
the original file and noticed the double catalog. (It doesn't happen with 2.0
so that isn't the cause for the SO issue)
was (Author: tilman):
It's also on several other output files in PDFBox
reactor/examples/target/test-output . The whole thing started when I
investigated https://stackoverflow.com/questions/71267471/ and ran signing with
the trunk on the original file and noticed the double catalog. (It doesn't
happen with 2.0 so that isn't the cause for the SO issue)
> Catalog object twice in signed file
> -----------------------------------
>
> Key: PDFBOX-5381
> URL: https://issues.apache.org/jira/browse/PDFBOX-5381
> Project: PDFBox
> Issue Type: Bug
> Components: Signing
> Affects Versions: 3.0.0 PDFBox
> Reporter: Tilman Hausherr
> Priority: Major
> Labels: regression
> Fix For: 3.0.0 PDFBox
>
> Attachments: PDFA_signed.pdf
>
>
> The catalog object is twice in the signed file
> {noformat}
> 1 0 obj
> <<
> /Type /Catalog
> /Version /1.4
> /Pages 2 0 R
> /Metadata 3 0 R
> /OutputIntents [4 0 R]
> /Perms 18 0 R
> /AcroForm <<
> /Fields [22 0 R]
> /SigFlags 3
> >>
> >>
> endobj
> 1 0 obj
> <<
> /Type /Catalog
> /Version /1.4
> /Pages 2 0 R
> /Metadata 3 0 R
> /OutputIntents [4 0 R]
> /Perms 18 0 R
> /AcroForm <<
> /Fields [22 0 R]
> /SigFlags 3
> >>
> >>
> endobj
> {noformat}
> here's a failing test, to be added at the end of CreatePDFATest.java (and
> probably elsewhere)
> {code}
> // Check that no object numbers are double
> File signedFile = new File(signedPdfaFilename);
> BufferedReader br = new BufferedReader(new InputStreamReader(new
> FileInputStream(signedFile)));
> String line;
> boolean isIncrementalArea = false;
> Set<String> set = new HashSet<>();
> int linePos = 0;
> while ((line = br.readLine()) != null)
> {
> ++linePos;
> if (line.equals("%%EOF"))
> {
> isIncrementalArea = true;
> }
> if (!isIncrementalArea)
> continue;
> if (line.matches("^\\d+ 0 obj$"))
> {
> int pos = line.indexOf(" 0 obj");
> line = line.substring(0, pos);
> assertFalse(set.contains(line), "object '" + line + " 0 obj' twice in
> incremental part of PDF at line " +linePos);
> set.add(line);
> }
> }
> br.close();
> {code}
> I don't know why it happens (although I remember I had such a thing years ago
> when trying different strategies while working on incremental saving in
> PDFBOX-45)
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]