[ 
https://issues.apache.org/jira/browse/PDFBOX-5381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Lehmkühler reassigned PDFBOX-5381:
------------------------------------------

    Assignee: Andreas Lehmkühler

> 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
>            Assignee: Andreas Lehmkühler
>            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 (line.equals("%%EOF"))
>     {
>         isIncrementalArea = true;
>         set.clear(); // for cases with several revisions
>     }
>     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: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to