Hello, 
 
The sample code for encrypting a PDF on the output formats [1] page is using an 
outdated version of iText. 
I have attached an updated snippet that achieves the same behavior using iText 
7. 
 
Also, the warning that iText “may swallow PDF bookmarks” does not appear to be 
relevant anymore. 
>From my testing, opening, editing, and saving a PdfDocument [2] preserves 
>existing bookmarks. 
 
The recommended fix (FOP-1100 [3]) is no longer relevant since PdfStamper 
doesn’t exist in modern versions of iText. 
Instead, creating a PdfDocument with both an input PdfReader and an output 
PdfWriter (as in the new sample code) opens the document in “stamping mode”, 
which does not destroy bookmarks. 
 
An update to the website reflecting these changes would be much appreciated. 
 
Sincerely, 
Ron Friedman 

[1] https://xmlgraphics.apache.org/fop/trunk/output.html
[2] 
https://api.itextpdf.com/iText/java/8.0.0/com/itextpdf/kernel/pdf/PdfDocument.html
[3] https://issues.apache.org/jira/browse/FOP-1100

Attachment: updated_itext_example.java
Description: updated_itext_example.java

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to