private void extract(String pdfFile, String password) throws IOException { try (PDDocument document = PDDocument.load(new File(pdfFile), password)) { AccessPermission ap = document.getCurrentAccessPermission(); if (!ap.canExtractContent()) { throw new IOException("You do not have permission to extract images"); } for (PDPage page : document.getPages()) { ImageGraphicsEngine extractor = new ImageGraphicsEngine(page); extractor.run(); } } }
AccessPermission ap = document.getCurrentAccessPermission(); if (!ap.canExtractContent())
AccessPermission ap = document.getCurrentAccessPermission(); if(ap.isOwnerPermission())
AccessPermission ap = document.getCurrentAccessPermission(); if( ! ap.canExtractContent() )
AccessPermission ap = document.getCurrentAccessPermission(); metadata.set(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY, Boolean.toString(ap.canExtractForAccessibility()));
AccessPermission ap = document.getCurrentAccessPermission(); if (!ap.canExtractContent())
document.openProtection(sdm); final AccessPermission ap = document .getCurrentAccessPermission();
document.openProtection(sdm); final AccessPermission ap = document.getCurrentAccessPermission();
decryptionMaterial = new StandardDecryptionMaterial(password); document.openProtection(decryptionMaterial); AccessPermission ap = document.getCurrentAccessPermission(); if(ap.isOwnerPermission())
private void extract(String pdfFile, String password) throws IOException { PDDocument document = null; try { document = PDDocument.load(new File(pdfFile), password); AccessPermission ap = document.getCurrentAccessPermission(); if (! ap.canExtractContent()) { throw new IOException("You do not have permission to extract images"); } for (PDPage page : document.getPages()) { ImageGraphicsEngine extractor = new ImageGraphicsEngine(page); extractor.run(); } } finally { if (document != null) { document.close(); } } }
document.openProtection(sdm); final AccessPermission ap = document.getCurrentAccessPermission();
private PDDocument getDocument(RandomAccessRead source) throws IOException, BleachException { PDDocument doc; for (String pwd : COMMON_PASSWORDS) { ScratchFile scratchFile = new ScratchFile(MEMORY_USAGE_SETTING); doc = testPassword(scratchFile, source, pwd); if (doc != null) { LOGGER.debug("Password was guessed: '{}'", pwd); doc.protect(new StandardProtectionPolicy(pwd, pwd, doc.getCurrentAccessPermission())); return doc; } scratchFile.close(); } // @TODO: fetch password from config? throw new BleachException("PDF is protected with an unknown password"); }
AccessPermission ap = document.getCurrentAccessPermission(); if(ap.isOwnerPermission())
AccessPermission ap = document.getCurrentAccessPermission(); if( ! ap.canExtractContent() )
AccessPermission ap = document.getCurrentAccessPermission(); if( ! ap.canExtractContent() )
AccessPermission ap = document.getCurrentAccessPermission(); if( ! ap.canExtractContent() )
subject = checkNotNull(docInfo.getSubject()); title = checkNotNull(docInfo.getTitle()); permissions = pdfDoc.getCurrentAccessPermission();
AccessPermission ap = document.getCurrentAccessPermission(); metadata.set(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY, Boolean.toString(ap.canExtractForAccessibility()));
AccessPermission ap = document.getCurrentAccessPermission(); metadata.set(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY, Boolean.toString(ap.canExtractForAccessibility()));
AccessPermission ap = document.getCurrentAccessPermission(); metadata.set(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY, Boolean.toString(ap.canExtractForAccessibility()));