diff options
author | Luis Bernardo <lbernardo@apache.org> | 2014-07-18 23:05:19 +0000 |
---|---|---|
committer | Luis Bernardo <lbernardo@apache.org> | 2014-07-18 23:05:19 +0000 |
commit | 136e3cfdd77d227ae53ea4f84b3f5e21c1773b18 (patch) | |
tree | 392ee85e0a6a3dd77ae88dae590bde4d9f59e622 /src | |
parent | cdf8be3d3a3f4fde67723863d368b1096c305de9 (diff) | |
download | xmlgraphics-fop-136e3cfdd77d227ae53ea4f84b3f5e21c1773b18.tar.gz xmlgraphics-fop-136e3cfdd77d227ae53ea4f84b3f5e21c1773b18.zip |
FOP-2395: PDF encryption does not work when PDF version is set in FOP config; change suggested by Seifeddine Dridi.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1611834 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFDocument.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/pdf/VersionController.java | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFDocument.java b/src/java/org/apache/fop/pdf/PDFDocument.java index a8d3d10c0..468d2f1c1 100644 --- a/src/java/org/apache/fop/pdf/PDFDocument.java +++ b/src/java/org/apache/fop/pdf/PDFDocument.java @@ -543,7 +543,9 @@ public class PDFDocument { PDFObject pdfObject = (PDFObject)this.encryption; addTrailerObject(pdfObject); try { - versionController.setPDFVersion(encryption.getPDFVersion()); + if (encryption.getPDFVersion().compareTo(versionController.getPDFVersion()) > 0) { + versionController.setPDFVersion(encryption.getPDFVersion()); + } } catch (IllegalStateException ise) { log.warn("Configured encryption requires PDF version " + encryption.getPDFVersion() + " but version has been set to " + versionController.getPDFVersion() + "."); diff --git a/src/java/org/apache/fop/pdf/VersionController.java b/src/java/org/apache/fop/pdf/VersionController.java index bd5e4d20f..d9c024515 100644 --- a/src/java/org/apache/fop/pdf/VersionController.java +++ b/src/java/org/apache/fop/pdf/VersionController.java @@ -69,7 +69,9 @@ public abstract class VersionController { @Override public void setPDFVersion(Version version) { - throw new IllegalStateException("Cannot change the version of this PDF document."); + if (super.version.compareTo(version) != 0) { + throw new IllegalStateException("Cannot change the version of this PDF document."); + } } @Override |