List of usage examples for com.lowagie.text.pdf PdfWriter ALLOW_PRINTING
int ALLOW_PRINTING
To view the source code for com.lowagie.text.pdf PdfWriter ALLOW_PRINTING.
Click Source Link
From source file:org.lucee.extension.pdf.util.PDFUtil.java
License:Open Source License
/** * convert a string defintion of a permision in a integer Constant (PdfWriter.ALLOW_XXX) * //from w w w. ja va2s . co m * @param strPermission * @return * @throws ApplicationException */ public static int toPermission(String strPermission) throws PageException { strPermission = strPermission.trim().toLowerCase(); if ("allowassembly".equals(strPermission)) return PdfWriter.ALLOW_ASSEMBLY; else if ("none".equals(strPermission)) return 0; else if ("all".equals(strPermission)) return PERMISSION_ALL; else if ("assembly".equals(strPermission)) return PdfWriter.ALLOW_ASSEMBLY; else if ("documentassembly".equals(strPermission)) return PdfWriter.ALLOW_ASSEMBLY; else if ("allowdegradedprinting".equals(strPermission)) return PdfWriter.ALLOW_DEGRADED_PRINTING; else if ("degradedprinting".equals(strPermission)) return PdfWriter.ALLOW_DEGRADED_PRINTING; else if ("printing".equals(strPermission)) return PdfWriter.ALLOW_DEGRADED_PRINTING; else if ("allowfillin".equals(strPermission)) return PdfWriter.ALLOW_FILL_IN; else if ("fillin".equals(strPermission)) return PdfWriter.ALLOW_FILL_IN; else if ("fillingform".equals(strPermission)) return PdfWriter.ALLOW_FILL_IN; else if ("allowmodifyannotations".equals(strPermission)) return PdfWriter.ALLOW_MODIFY_ANNOTATIONS; else if ("modifyannotations".equals(strPermission)) return PdfWriter.ALLOW_MODIFY_ANNOTATIONS; else if ("allowmodifycontents".equals(strPermission)) return PdfWriter.ALLOW_MODIFY_CONTENTS; else if ("modifycontents".equals(strPermission)) return PdfWriter.ALLOW_MODIFY_CONTENTS; else if ("allowcopy".equals(strPermission)) return PdfWriter.ALLOW_COPY; else if ("copy".equals(strPermission)) return PdfWriter.ALLOW_COPY; else if ("copycontent".equals(strPermission)) return PdfWriter.ALLOW_COPY; else if ("allowprinting".equals(strPermission)) return PdfWriter.ALLOW_PRINTING; else if ("printing".equals(strPermission)) return PdfWriter.ALLOW_PRINTING; else if ("allowscreenreaders".equals(strPermission)) return PdfWriter.ALLOW_SCREENREADERS; else if ("screenreaders".equals(strPermission)) return PdfWriter.ALLOW_SCREENREADERS; else throw CFMLEngineFactory.getInstance().getExceptionUtil() .createApplicationException("invalid permission [" + strPermission + "], valid permission values are [AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, AllowAssembly, AllowDegradedPrinting]"); }
From source file:org.oss.pdfreporter.pdf.Document.java
License:Open Source License
private static int convertPermission(int permission) throws DocumentException { int translated = 0; if ((permission & PERMISSION_COPY) == PERMISSION_COPY) { translated |= PdfWriter.ALLOW_COPY; }// w w w . j av a 2 s. c o m if ((permission & PERMISSION_COPY) == PERMISSION_EDIT) { translated |= PdfWriter.ALLOW_MODIFY_ANNOTATIONS; } if ((permission & PERMISSION_COPY) == PERMISSION_EDIT_ALL) { translated |= PdfWriter.ALLOW_MODIFY_CONTENTS; } if ((permission & PERMISSION_COPY) == PERMISSION_READ) { translated |= PdfWriter.ALLOW_SCREENREADERS; } if ((permission & PERMISSION_COPY) == PERMISSION_PRINT) { translated |= PdfWriter.ALLOW_PRINTING; } return translated; }
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 . ja v a 2 s. c om*/ 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 w w w . j a v a2 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.j ava 2 s . c o m */ 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; }