You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Adam Nichols (JIRA)" <ji...@apache.org> on 2010/05/03 21:23:59 UTC

[jira] Created: (PDFBOX-719) Bookmarks not merged correctly by PDFMergerUtility

Bookmarks not merged correctly by PDFMergerUtility
--------------------------------------------------

                 Key: PDFBOX-719
                 URL: https://issues.apache.org/jira/browse/PDFBOX-719
             Project: PDFBox
          Issue Type: Bug
          Components: Utilities
         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 940574)
            Reporter: Adam Nichols
             Fix For: 1.2.0


When multiple PDFs with bookmarks are merged, not all of the bookmarks are in the output and they are not in the expected order.  The output will have all bookmarks from the first file, the first bookmark from all files, and then the bookmarks 2-n of file #2.  Files 3 and above will only have the first bookmark copied over.

The expected behavior is that all bookmarks for file 1 appear, followed by all bookmarks for files 2, then all bookmarks for file 3 and so on.

Code to duplicate the problem:
String inputFile = "C:\\US_Constitutional_Ammendments_bookmarked.pdf";
String outputFile = "C:\\US_Constitutional_Ammendments_bookmarked3.pdf";

PDFMergerUtility merger = new PDFMergerUtility();
merger.setDestinationFileName(outputFile);
merger.addSource(inputFile);
merger.addSource(inputFile);
merger.addSource(inputFile);
merger.mergeDocuments();


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-719) Bookmarks not merged correctly by PDFMergerUtility

Posted by "Adam Nichols (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Nichols updated PDFBOX-719:
--------------------------------

    Attachment: PDFBOX-717.patch

The issue was that the "Last" bookmarks (according to the outline) was updated to the node which was being appended.  It didn't consider that there may be "next" nodes in that bookmark.

For example, if we have three documents with bookmarks a, b, c; d, e, f; and x, y, z (respectively), after merging the first two documents, the old code would result in: a, b, c, d, e, f but the "Last" node would point to "d".  Consequently, when the next file is merged in, we get a, b, c, d, x, e, f.  By updating the "Last" pointer correctly, it resolves this issue.

> Bookmarks not merged correctly by PDFMergerUtility
> --------------------------------------------------
>
>                 Key: PDFBOX-719
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-719
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 940574)
>            Reporter: Adam Nichols
>             Fix For: 1.2.0
>
>         Attachments: PDFBOX-717.patch, US_Constitutional_Ammendments_bookmarked.pdf
>
>
> When multiple PDFs with bookmarks are merged, not all of the bookmarks are in the output and they are not in the expected order.  The output will have all bookmarks from the first file, the first bookmark from all files, and then the bookmarks 2-n of file #2.  Files 3 and above will only have the first bookmark copied over.
> The expected behavior is that all bookmarks for file 1 appear, followed by all bookmarks for files 2, then all bookmarks for file 3 and so on.
> Code to duplicate the problem:
> String inputFile = "C:\\US_Constitutional_Ammendments_bookmarked.pdf";
> String outputFile = "C:\\US_Constitutional_Ammendments_bookmarked3.pdf";
> PDFMergerUtility merger = new PDFMergerUtility();
> merger.setDestinationFileName(outputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.mergeDocuments();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-719) Bookmarks not merged correctly by PDFMergerUtility

Posted by "Adam Nichols (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Nichols updated PDFBOX-719:
--------------------------------

    Attachment: US_Constitutional_Ammendments_bookmarked.pdf

This is the file used in the test code.  I also grant the ASF license for the test code listed in the issue.

> Bookmarks not merged correctly by PDFMergerUtility
> --------------------------------------------------
>
>                 Key: PDFBOX-719
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-719
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 940574)
>            Reporter: Adam Nichols
>             Fix For: 1.2.0
>
>         Attachments: US_Constitutional_Ammendments_bookmarked.pdf
>
>
> When multiple PDFs with bookmarks are merged, not all of the bookmarks are in the output and they are not in the expected order.  The output will have all bookmarks from the first file, the first bookmark from all files, and then the bookmarks 2-n of file #2.  Files 3 and above will only have the first bookmark copied over.
> The expected behavior is that all bookmarks for file 1 appear, followed by all bookmarks for files 2, then all bookmarks for file 3 and so on.
> Code to duplicate the problem:
> String inputFile = "C:\\US_Constitutional_Ammendments_bookmarked.pdf";
> String outputFile = "C:\\US_Constitutional_Ammendments_bookmarked3.pdf";
> PDFMergerUtility merger = new PDFMergerUtility();
> merger.setDestinationFileName(outputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.mergeDocuments();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (PDFBOX-719) Bookmarks not merged correctly by PDFMergerUtility

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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

    Assignee: Andreas Lehmkühler

> Bookmarks not merged correctly by PDFMergerUtility
> --------------------------------------------------
>
>                 Key: PDFBOX-719
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-719
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 940574)
>            Reporter: Adam Nichols
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.2.0
>
>         Attachments: PDFBOX-719.patch, US_Constitutional_Ammendments_bookmarked.pdf
>
>
> When multiple PDFs with bookmarks are merged, not all of the bookmarks are in the output and they are not in the expected order.  The output will have all bookmarks from the first file, the first bookmark from all files, and then the bookmarks 2-n of file #2.  Files 3 and above will only have the first bookmark copied over.
> The expected behavior is that all bookmarks for file 1 appear, followed by all bookmarks for files 2, then all bookmarks for file 3 and so on.
> Code to duplicate the problem:
> String inputFile = "C:\\US_Constitutional_Ammendments_bookmarked.pdf";
> String outputFile = "C:\\US_Constitutional_Ammendments_bookmarked3.pdf";
> PDFMergerUtility merger = new PDFMergerUtility();
> merger.setDestinationFileName(outputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.mergeDocuments();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PDFBOX-719) Bookmarks not merged correctly by PDFMergerUtility

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-719.
---------------------------------------

    Resolution: Fixed

I've added the patch with version 953108.

Thanks to Adam for the contribution.

> Bookmarks not merged correctly by PDFMergerUtility
> --------------------------------------------------
>
>                 Key: PDFBOX-719
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-719
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 940574)
>            Reporter: Adam Nichols
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.2.0
>
>         Attachments: PDFBOX-719.patch, US_Constitutional_Ammendments_bookmarked.pdf
>
>
> When multiple PDFs with bookmarks are merged, not all of the bookmarks are in the output and they are not in the expected order.  The output will have all bookmarks from the first file, the first bookmark from all files, and then the bookmarks 2-n of file #2.  Files 3 and above will only have the first bookmark copied over.
> The expected behavior is that all bookmarks for file 1 appear, followed by all bookmarks for files 2, then all bookmarks for file 3 and so on.
> Code to duplicate the problem:
> String inputFile = "C:\\US_Constitutional_Ammendments_bookmarked.pdf";
> String outputFile = "C:\\US_Constitutional_Ammendments_bookmarked3.pdf";
> PDFMergerUtility merger = new PDFMergerUtility();
> merger.setDestinationFileName(outputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.mergeDocuments();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-719) Bookmarks not merged correctly by PDFMergerUtility

Posted by "Adam Nichols (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Nichols updated PDFBOX-719:
--------------------------------

    Attachment:     (was: PDFBOX-717.patch)

> Bookmarks not merged correctly by PDFMergerUtility
> --------------------------------------------------
>
>                 Key: PDFBOX-719
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-719
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 940574)
>            Reporter: Adam Nichols
>             Fix For: 1.2.0
>
>         Attachments: PDFBOX-719.patch, US_Constitutional_Ammendments_bookmarked.pdf
>
>
> When multiple PDFs with bookmarks are merged, not all of the bookmarks are in the output and they are not in the expected order.  The output will have all bookmarks from the first file, the first bookmark from all files, and then the bookmarks 2-n of file #2.  Files 3 and above will only have the first bookmark copied over.
> The expected behavior is that all bookmarks for file 1 appear, followed by all bookmarks for files 2, then all bookmarks for file 3 and so on.
> Code to duplicate the problem:
> String inputFile = "C:\\US_Constitutional_Ammendments_bookmarked.pdf";
> String outputFile = "C:\\US_Constitutional_Ammendments_bookmarked3.pdf";
> PDFMergerUtility merger = new PDFMergerUtility();
> merger.setDestinationFileName(outputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.mergeDocuments();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-719) Bookmarks not merged correctly by PDFMergerUtility

Posted by "Adam Nichols (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Nichols updated PDFBOX-719:
--------------------------------

    Attachment: PDFBOX-719.patch

The issue was that the "Last" bookmarks (according to the outline) was updated to the node which was being appended. It didn't consider that there may be "next" nodes in that bookmark.

For example, if we have three documents with bookmarks a, b, c; d, e, f; and x, y, z (respectively), after merging the first two documents, the old code would result in: a, b, c, d, e, f but the "Last" node would point to "d". Consequently, when the next file is merged in, we get a, b, c, d, x, e, f. By updating the "Last" pointer correctly, it resolves this issue.

> Bookmarks not merged correctly by PDFMergerUtility
> --------------------------------------------------
>
>                 Key: PDFBOX-719
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-719
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 940574)
>            Reporter: Adam Nichols
>             Fix For: 1.2.0
>
>         Attachments: PDFBOX-719.patch, US_Constitutional_Ammendments_bookmarked.pdf
>
>
> When multiple PDFs with bookmarks are merged, not all of the bookmarks are in the output and they are not in the expected order.  The output will have all bookmarks from the first file, the first bookmark from all files, and then the bookmarks 2-n of file #2.  Files 3 and above will only have the first bookmark copied over.
> The expected behavior is that all bookmarks for file 1 appear, followed by all bookmarks for files 2, then all bookmarks for file 3 and so on.
> Code to duplicate the problem:
> String inputFile = "C:\\US_Constitutional_Ammendments_bookmarked.pdf";
> String outputFile = "C:\\US_Constitutional_Ammendments_bookmarked3.pdf";
> PDFMergerUtility merger = new PDFMergerUtility();
> merger.setDestinationFileName(outputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.addSource(inputFile);
> merger.mergeDocuments();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.