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 2021/01/16 12:54:05 UTC
svn commit: r1885559 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
Author: tilman
Date: Sat Jan 16 12:54:05 2021
New Revision: 1885559
URL: http://svn.apache.org/viewvc?rev=1885559&view=rev
Log:
PDFBOX-4892: improve javadoc - people should not use PDDocument after saving encrypted because it's encrypted
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1885559&r1=1885558&r2=1885559&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Sat Jan 16 12:54:05 2021
@@ -1306,6 +1306,10 @@ public class PDDocument implements Close
/**
* Save the document to a file.
+ * <p>
+ * If encryption has been activated (with
+ * {@link #protect(org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy) protect(ProtectionPolicy)}),
+ * do not use the document after saving because the contents are now encrypted.
*
* @param fileName The file to save as.
*
@@ -1318,6 +1322,10 @@ public class PDDocument implements Close
/**
* Save the document to a file.
+ * <p>
+ * If encryption has been activated (with
+ * {@link #protect(org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy) protect(ProtectionPolicy)}),
+ * do not use the document after saving because the contents are now encrypted.
*
* @param file The file to save as.
*
@@ -1330,6 +1338,10 @@ public class PDDocument implements Close
/**
* This will save the document to an output stream.
+ * <p>
+ * If encryption has been activated (with
+ * {@link #protect(org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy) protect(ProtectionPolicy)}),
+ * do not use the document after saving because the contents are now encrypted.
*
* @param output The stream to write to. It will be closed when done. It is recommended to wrap
* it in a {@link java.io.BufferedOutputStream}, unless it is already buffered.
@@ -1596,6 +1608,8 @@ public class PDDocument implements Close
* encrypted when it will be saved. This method only marks the document for encryption. It also
* calls {@link #setAllSecurityToBeRemoved(boolean)} with a false argument if it was set to true
* previously and logs a warning.
+ * <p>
+ * Do not use the document after saving, because the structures are encrypted.
*
* @see org.apache.pdfbox.pdmodel.encryption.StandardProtectionPolicy
* @see org.apache.pdfbox.pdmodel.encryption.PublicKeyProtectionPolicy