Author: tilman
Date: Sat Nov 11 17:39:46 2023
New Revision: 1913718

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

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

Modified: 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1913718&r1=1913717&r2=1913718&view=diff
==============================================================================
--- 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
 (original)
+++ 
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
 Sat Nov 11 17:39:46 2023
@@ -1060,6 +1060,17 @@ 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>
+     * <p>
      * 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


Reply via email to