List of usage examples for com.itextpdf.text.pdf PdfWriter ALLOW_MODIFY_ANNOTATIONS
int ALLOW_MODIFY_ANNOTATIONS
To view the source code for com.itextpdf.text.pdf PdfWriter ALLOW_MODIFY_ANNOTATIONS.
Click Source Link
From source file:org.alfresco.extension.pdftoolkit.repo.action.executer.PDFEncryptionActionExecuter.java
License:Apache License
/** * Build the permissions mask for iText/*from w ww . j a va2 s.c o m*/ * * @param options * @return */ private int buildPermissionMask(Map<String, Object> options) { int permissions = 0; if ((Boolean) options.get(PARAM_ALLOW_PRINT)) { permissions = permissions | PdfWriter.ALLOW_PRINTING; } if ((Boolean) options.get(PARAM_ALLOW_COPY)) { permissions = permissions | PdfWriter.ALLOW_COPY; } if ((Boolean) options.get(PARAM_ALLOW_CONTENT_MODIFICATION)) { permissions = permissions | PdfWriter.ALLOW_MODIFY_CONTENTS; } if ((Boolean) options.get(PARAM_ALLOW_ANNOTATION_MODIFICATION)) { permissions = permissions | PdfWriter.ALLOW_MODIFY_ANNOTATIONS; } if ((Boolean) options.get(PARAM_ALLOW_SCREEN_READER)) { permissions = permissions | PdfWriter.ALLOW_SCREENREADERS; } if ((Boolean) options.get(PARAM_ALLOW_DEGRADED_PRINT)) { permissions = permissions | PdfWriter.ALLOW_DEGRADED_PRINTING; } if ((Boolean) options.get(PARAM_ALLOW_ASSEMBLY)) { permissions = permissions | PdfWriter.ALLOW_ASSEMBLY; } if ((Boolean) options.get(PARAM_ALLOW_FORM_FILL)) { permissions = permissions | PdfWriter.ALLOW_FILL_IN; } return permissions; }
From source file:org.la3.pdfunlock.PdfUnlock.java
License:BSD License
private void launch(String[] args) throws Exception { parseOptions(args);/*from w w w .j a v a 2 s.c o m*/ System.err.println("Unlocking " + lockedFile + " to " + unlockedFile); PdfReader reader; if (password == null) { reader = new PdfReader(lockedFile); } else { reader = new PdfReader(lockedFile, password.getBytes()); } PdfEncryptor.encrypt(reader, new FileOutputStream(unlockedFile), null, null, PdfWriter.ALLOW_ASSEMBLY | PdfWriter.ALLOW_COPY | PdfWriter.ALLOW_DEGRADED_PRINTING | PdfWriter.ALLOW_FILL_IN | PdfWriter.ALLOW_MODIFY_ANNOTATIONS | PdfWriter.ALLOW_MODIFY_CONTENTS | PdfWriter.ALLOW_PRINTING | PdfWriter.ALLOW_SCREENREADERS, false); System.err.println("PDF Unlocked successfully!"); System.exit(0); }