Re: Annotations + incrementalSave + specific PDF (pdfbox2) = no annotation displayed

2023-11-01 Thread Tilman Hausherr
I don't know if there is any risk. Mostly that you forget to add enough objects. But if you do, you'll notice if you look at the file and don't see the changes. Tilman On 01.11.2023 10:34, Frédéric Ravetier wrote: Thank you for this solution. What is the risk to use the second

Re: Annotations + incrementalSave + specific PDF (pdfbox2) = no annotation displayed

2023-11-01 Thread Frédéric Ravetier
Thank you for this solution. What is the risk to use the second incrementalSave with COS in param ? Le mar. 31 oct. 2023 à 19:38, Tilman Hausherr a écrit : > I got it to work with the classic method by adding this code before saving: > > > COSDictionary parent = >

Re: Annotations + incrementalSave + specific PDF (pdfbox2) = no annotation displayed

2023-10-31 Thread Tilman Hausherr
I got it to work with the classic method by adding this code before saving:     COSDictionary parent = page.getCOSObject().getCOSDictionary(COSName.PARENT);     while (parent != null)     {     parent.setNeedToBeUpdated(true);     parent =

Re: Annotations + incrementalSave + specific PDF (pdfbox2) = no annotation displayed

2023-10-31 Thread Frédéric Ravetier
I added that : Get the COSObject of the new annotation (stamp), add it to the set of COSToWrite and pass this information to the saveIncremental. Set setCOSObjectToWrite = new HashSet() ; setCOSObjectToWrite.add(stamp.getCOSObject()); doc.saveIncremental(resultFile, setCOSObjectToWrite); And

Re: Annotations + incrementalSave + specific PDF (pdfbox2) = no annotation displayed

2023-10-31 Thread Tilman Hausherr
Hi, I don't have time right now to test my theory, which would require setting update marks on the intermediate pagetree objects. In the meantime please try using the other saveIncremental call, where you pass COSDictionary objects. You'll probably need to only pass the page and your

Re: Annotations + incrementalSave + specific PDF (pdfbox2) = no annotation displayed

2023-10-30 Thread Frédéric Ravetier
Thanks for your answer Tilman, * I was using 2.0.29 * this code is working well with all the pdf I used until now * I did a test using pdfbox3 and it works but my code using pdf3 is not production ready :( I prepare a test class that you can use

Re: Annotations + incrementalSave + specific PDF (pdfbox2) = no annotation displayed

2023-10-30 Thread Tilman Hausherr
Hi, The annotations are missing in the incremental part. My guess is that you didn't include it in the update. You've updated the document catalog but not the page. Read the javadoc of the saveIncremental() carefully. If you can't get it to work, please share the smallest possible code that