/** * Qoppa Software - Source Code Sample */ package jPDFSecureSamples; import com.qoppa.pdf.PDFPermissions; import com.qoppa.pdfSecure.PDFSecure; public class ListPermissions { public static void main (String [] args) { try { // Load the document PDFSecure pdfSecure = new PDFSecure ("input.pdf", null); // Check if there are open and permissions passwords System.out.println ("Open Password - " + getYesNo (pdfSecure.hasOpenPassword())); System.out.println ("Permissiosn Password - " + getYesNo(pdfSecure.hasPermissionsPassword())); System.out.println (); // Get the current permissions PDFPermissions perms = pdfSecure.getPermissions(); System.out.println ("Assemble Document - " + getYesNo(perms.isAssembleDocumentAllowed())); System.out.println ("Change Document - " + getYesNo(perms.isChangeDocumentAllowed())); System.out.println ("Extract Content - " + getYesNo(perms.isExtractTextGraphicsAllowed())); System.out.println ("Extract Content for Accessibility - " + getYesNo(perms.isExtractTextGraphicsForAccessibilityAllowed())); System.out.println ("Fill Form Fields - " + getYesNo(perms.isFillFormFieldsAllowed())); System.out.println ("Modify Annotations - " + getYesNo(perms.isModifyAnnotsAllowed())); System.out.println ("Print - " + getYesNo(perms.isPrintAllowed())); System.out.println ("Print High Resolution - " + getYesNo(perms.isPrintHighResAllowed())); // Save the document pdfSecure.saveDocument ("output.pdf"); } catch (Throwable t) { t.printStackTrace(); } } private static String getYesNo (boolean yes) { if (yes) { return "Yes"; } else { return "No"; } } }