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() + ".");
@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