List of usage examples for com.lowagie.text.pdf PdfWriter ALLOW_COPY
int ALLOW_COPY
To view the source code for com.lowagie.text.pdf PdfWriter ALLOW_COPY.
Click Source Link
From source file:org.pdfsam.console.business.parser.validators.EncryptCmdValidator.java
License:Open Source License
/** * @param encryptionType encryption algorithm * @return The permissions map based on the chosen encryption *///from w w w. j a v a 2 s . c o m private Hashtable getPermissionsMap(String encryptionType) { Hashtable retMap = new Hashtable(12); if (EncryptParsedCommand.E_RC4_40.equals(encryptionType)) { retMap.put(EncryptParsedCommand.E_PRINT, new Integer(PdfWriter.ALLOW_PRINTING)); retMap.put(EncryptParsedCommand.E_MODIFY, new Integer(PdfWriter.ALLOW_MODIFY_CONTENTS)); retMap.put(EncryptParsedCommand.E_COPY, new Integer(PdfWriter.ALLOW_COPY)); retMap.put(EncryptParsedCommand.E_ANNOTATION, new Integer(PdfWriter.ALLOW_MODIFY_ANNOTATIONS)); } else { retMap.put(EncryptParsedCommand.E_PRINT, new Integer(PdfWriter.ALLOW_PRINTING)); retMap.put(EncryptParsedCommand.E_MODIFY, new Integer(PdfWriter.ALLOW_MODIFY_CONTENTS)); retMap.put(EncryptParsedCommand.E_COPY, new Integer(PdfWriter.ALLOW_COPY)); retMap.put(EncryptParsedCommand.E_ANNOTATION, new Integer(PdfWriter.ALLOW_MODIFY_ANNOTATIONS)); retMap.put(EncryptParsedCommand.E_FILL, new Integer(PdfWriter.ALLOW_FILL_IN)); retMap.put(EncryptParsedCommand.E_SCREEN, new Integer(PdfWriter.ALLOW_SCREENREADERS)); retMap.put(EncryptParsedCommand.E_ASSEMBLY, new Integer(PdfWriter.ALLOW_ASSEMBLY)); retMap.put(EncryptParsedCommand.E_DPRINT, new Integer(PdfWriter.ALLOW_DEGRADED_PRINTING)); } return retMap; }
From source file:org.pdfsam.guiclient.commons.business.loaders.callable.AddPdfDocument.java
License:Open Source License
/** * It gives a human readable version of the document permissions * @param permissions/*from ww w .j av a 2 s . c om*/ * @return */ private String getPermissionsVerbose(int permissions) { StringBuffer buf = new StringBuffer(); if ((PdfWriter.ALLOW_PRINTING & permissions) == PdfWriter.ALLOW_PRINTING) buf.append(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "Print")); if ((PdfWriter.ALLOW_MODIFY_CONTENTS & permissions) == PdfWriter.ALLOW_MODIFY_CONTENTS) buf.append( ", " + GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "Modify")); if ((PdfWriter.ALLOW_COPY & permissions) == PdfWriter.ALLOW_COPY) buf.append(", " + GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "Copy or extract")); if ((PdfWriter.ALLOW_MODIFY_ANNOTATIONS & permissions) == PdfWriter.ALLOW_MODIFY_ANNOTATIONS) buf.append(", " + GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "Add or modify text annotations")); if ((PdfWriter.ALLOW_FILL_IN & permissions) == PdfWriter.ALLOW_FILL_IN) buf.append(", " + GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "Fill form fields")); if ((PdfWriter.ALLOW_SCREENREADERS & permissions) == PdfWriter.ALLOW_SCREENREADERS) buf.append(", " + GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "Extract for use by accessibility dev.")); if ((PdfWriter.ALLOW_ASSEMBLY & permissions) == PdfWriter.ALLOW_ASSEMBLY) buf.append(", " + GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "Manipulate pages and add bookmarks")); if ((PdfWriter.ALLOW_DEGRADED_PRINTING & permissions) == PdfWriter.ALLOW_DEGRADED_PRINTING) buf.append(", " + GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(), "Low quality print")); return buf.toString(); }
From source file:org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.internal.PdfDocumentWriter.java
License:Open Source License
/** * Extracts the permissions for this PDF. The permissions are returned as flags in the integer value. All permissions * are defined as properties which have to be set before the target is opened. * * @return the permissions./*from w w w . jav a 2 s .c om*/ */ private int getPermissions() { final String printLevel = config.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.PrintLevel"); final boolean allowPrinting = "none".equals(printLevel) == false; final boolean allowDegradedPrinting = "degraded".equals(printLevel); final boolean allowModifyContents = "true".equals(config.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.AllowModifyContents")); final boolean allowModifyAnn = "true".equals(config.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.AllowModifyAnnotations")); final boolean allowCopy = "true".equals(config.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.AllowCopy")); final boolean allowFillIn = "true".equals(config.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.AllowFillIn")); final boolean allowScreenReaders = "true".equals(config.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.AllowScreenReader")); final boolean allowAssembly = "true".equals(config.getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.pageable.pdf.AllowAssembly")); int permissions = 0; if (allowPrinting) { permissions |= PdfWriter.ALLOW_PRINTING; } if (allowModifyContents) { permissions |= PdfWriter.ALLOW_MODIFY_CONTENTS; } if (allowModifyAnn) { permissions |= PdfWriter.ALLOW_MODIFY_ANNOTATIONS; } if (allowCopy) { permissions |= PdfWriter.ALLOW_COPY; } if (allowFillIn) { permissions |= PdfWriter.ALLOW_FILL_IN; } if (allowScreenReaders) { permissions |= PdfWriter.ALLOW_SCREENREADERS; } if (allowAssembly) { permissions |= PdfWriter.ALLOW_ASSEMBLY; } if (allowDegradedPrinting) { permissions |= PdfWriter.ALLOW_DEGRADED_PRINTING; } return permissions; }