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 2023/11/11 17:39:54 UTC

svn commit: r1913720 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java

Author: tilman
Date: Sat Nov 11 17:39:54 2023
New Revision: 1913720

URL: http://svn.apache.org/viewvc?rev=1913720&view=rev
Log:
PDFBOX-5660: improve javadoc because of troubles with multilevel page tree

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1913720&r1=1913719&r2=1913720&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Sat Nov 11 17:39:54 2023
@@ -1060,6 +1060,16 @@ public class PDDocument implements Close
      * <a href="https://stackoverflow.com/questions/74836898/">can cause trouble when PDFs get
      * signed</a>. (PDFBox already does this for signature widget annotations)
      * <p>
+     * Another problem with page-based modifications can occur if the page tree isn't flat: there
+     * won't be an closed update path from the catalog to the page. To fix this, add code like this:
+     * <pre>{@code
+     * COSDictionary parent = page.getCOSObject().getCOSDictionary(COSName.PARENT);
+     * while (parent != null)
+     * {
+     *     parent.setNeedToBeUpdated(true);
+     *     parent = parent.getCOSDictionary(COSName.PARENT);
+     * }
+     * }</pre>
      * Don't use the input file as target as this will produce a corrupted file.
      *
      * @param output stream to write to. It will be closed when done. It <i><b>must never</b></i> point to the source