You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2017/01/18 21:16:23 UTC
svn commit: r1779384 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java
Author: tilman
Date: Wed Jan 18 21:16:23 2017
New Revision: 1779384
URL: http://svn.apache.org/viewvc?rev=1779384&view=rev
Log:
PDFBOX-3652: search for last 1st level sibling instead of using /Last, as suggested by Christian Hadi
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java?rev=1779384&r1=1779383&r2=1779384&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java Wed Jan 18 21:16:23 2017
@@ -427,6 +427,12 @@ public class PDFMergerUtility
}
else
{
+ // search last sibling for dest, because /Last entry is sometimes wrong
+ PDOutlineItem destLastOutlineItem = destOutline.getFirstChild();
+ while (destLastOutlineItem.getNextSibling() != null)
+ {
+ destLastOutlineItem = destLastOutlineItem.getNextSibling();
+ }
for (PDOutlineItem item : srcOutline.children())
{
// get each child, clone its dictionary, remove siblings info,
@@ -435,7 +441,8 @@ public class PDFMergerUtility
clonedDict.removeItem(COSName.PREV);
clonedDict.removeItem(COSName.NEXT);
PDOutlineItem clonedItem = new PDOutlineItem(clonedDict);
- destOutline.addLast(clonedItem);
+ destLastOutlineItem.insertSiblingAfter(clonedItem);
+ destLastOutlineItem = destLastOutlineItem.getNextSibling();
}
}
}