Examples of canExtractContent()


Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

        mLog.debug("Document is encrypted: " + url);
        StandardDecryptionMaterial sdm = new StandardDecryptionMaterial("");
        pdfDocument.openProtection(sdm);
        AccessPermission ap = pdfDocument.getCurrentAccessPermission();

        if (!ap.canExtractContent()) {
          throw new RegainException("Document is encrypted and can't be opened: " + url);
        }
      }

      // Extract the text with a utility class
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

            } catch (final CryptographyException e) {
                try {pdfDoc.close();} catch (final IOException ee) {}
                throw new Parser.Failure("Document is encrypted (3): " + e.getMessage(), location);
            }
            final AccessPermission perm = pdfDoc.getCurrentAccessPermission();
            if (perm == null || !perm.canExtractContent())
                throw new Parser.Failure("Document is encrypted and cannot be decrypted", location);
        }

        // extracting some metadata
        final PDDocumentInformation info = pdfDoc.getDocumentInformation();
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

                        document.openProtection( sdm );
                    }
                }
               
                AccessPermission ap = document.getCurrentAccessPermission();
                if( ! ap.canExtractContent() )
                {
                    throw new IOException( "You do not have permission to extract text" );
                }
               
                stopProcessing("Time for loading: ", startTime);
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

                    StandardDecryptionMaterial spm = new StandardDecryptionMaterial(password);
                    document.openProtection(spm);
                }
            }
            AccessPermission ap = document.getCurrentAccessPermission();
            if (! ap.canExtractContent())
            {
                throw new IOException("You do not have permission to extract images");
            }

            for (int i = 0; i < document.getNumberOfPages(); i++) // todo: ITERATOR would be much better
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

        // check permissions
        assertEquals(expectedPermissions.isOwnerPermission(), currentAccessPermission.isOwnerPermission());
        assertEquals(expectedPermissions.isReadOnly(), currentAccessPermission.isReadOnly());
        assertEquals(expectedPermissions.canAssembleDocument(), currentAccessPermission.canAssembleDocument());
        assertEquals(expectedPermissions.canExtractContent(), currentAccessPermission.canExtractContent());
        assertEquals(expectedPermissions.canExtractForAccessibility(), currentAccessPermission.canExtractForAccessibility());
        assertEquals(expectedPermissions.canFillInForm(), currentAccessPermission.canFillInForm());
        assertEquals(expectedPermissions.canModify(), currentAccessPermission.canModify());
        assertEquals(expectedPermissions.canModifyAnnotations(), currentAccessPermission.canModifyAnnotations());
        assertEquals(expectedPermissions.canPrint(), currentAccessPermission.canPrint());
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

            encryptedDoc.openProtection(decryption1);

            AccessPermission permission =
                encryptedDoc.getCurrentAccessPermission();
            Assert.assertFalse(permission.canAssembleDocument());
            Assert.assertFalse(permission.canExtractContent());
            Assert.assertTrue(permission.canExtractForAccessibility());
            Assert.assertFalse(permission.canFillInForm());
            Assert.assertFalse(permission.canModify());
            Assert.assertFalse(permission.canModifyAnnotations());
            Assert.assertFalse(permission.canPrint());
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

            encryptedDoc1.openProtection(decryption1);

            AccessPermission permission =
                encryptedDoc1.getCurrentAccessPermission();
            Assert.assertFalse(permission.canAssembleDocument());
            Assert.assertFalse(permission.canExtractContent());
            Assert.assertTrue(permission.canExtractForAccessibility());
            Assert.assertFalse(permission.canFillInForm());
            Assert.assertFalse(permission.canModify());
            Assert.assertFalse(permission.canModifyAnnotations());
            Assert.assertFalse(permission.canPrint());
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

            encryptedDoc2.openProtection(decryption2);

            AccessPermission permission =
                encryptedDoc2.getCurrentAccessPermission();
            Assert.assertFalse(permission.canAssembleDocument());
            Assert.assertFalse(permission.canExtractContent());
            Assert.assertTrue(permission.canExtractForAccessibility());
            Assert.assertFalse(permission.canFillInForm());
            Assert.assertFalse(permission.canModify());
            Assert.assertFalse(permission.canModifyAnnotations());
            Assert.assertTrue(permission.canPrint());
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

                        document.openProtection( sdm );
                    }
                }
               
                AccessPermission ap = document.getCurrentAccessPermission();
                if( ! ap.canExtractContent() )
                {
                    throw new IOException( "You do not have permission to extract text" );
                }
               
                stopProcessing("Time for loading: ", startTime);
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.encryption.AccessPermission.canExtractContent()

                securityHandler = SecurityHandlersManager.getInstance().getSecurityHandler(encParameters.getFilter());
                securityHandler.prepareForDecryption(encParameters, document.getDocumentID(), decryptionMaterial);

                AccessPermission permission = securityHandler.getCurrentAccessPermission();
                if (!permission.canExtractContent())
                {
                    LOG.warn("PDF file '" + pdfFile.getPath() + "' does not allow extracting content.");
                }

            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.