List of usage examples for com.itextpdf.text.pdf PdfWriter setEncryption
@Deprecated public void setEncryption(final int encryptionType, final String userPassword, final String ownerPassword, final int permissions) throws DocumentException
From source file:com.github.albfernandez.joinpdf.JoinPdf.java
License:Open Source License
private void setParametersAndHeaders(final PdfWriter writer, final Document document) throws DocumentException { if (this.extraCompression) { writer.setFullCompression();/*from ww w . ja v a2 s. c o m*/ } if (this.isCrypt() && bouncyCastleLoaded) { int permisos = PdfWriter.ALLOW_PRINTING; writer.setEncryption(null, null, permisos, PdfWriter.ENCRYPTION_AES_128); } if (!StringUtils.isBlank(this.getMetadataAuthor())) { document.addAuthor(this.getMetadataAuthor()); } if (!StringUtils.isBlank(this.getMetadataKeywords())) { document.addKeywords(this.getMetadataKeywords()); } if (!StringUtils.isBlank(this.getMetadataTitle())) { document.addTitle(this.getMetadataTitle()); } if (!StringUtils.isBlank(this.getMetadataSubject())) { document.addSubject(this.getMetadataSubject()); } }