Examples of openProtection()


Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

      // Decrypt the PDF-Dokument
      if (pdfDocument.isEncrypted()) {
        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);
        }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

            Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
        }

        if (pdfDoc.isEncrypted()) {
            try {
                pdfDoc.openProtection(new StandardDecryptionMaterial(""));
            } catch (final BadSecurityHandlerException e) {
                try {pdfDoc.close();} catch (final IOException ee) {}
                throw new Parser.Failure("Document is encrypted (1): " + e.getMessage(), location);
            } catch (final IOException e) {
                try {pdfDoc.close();} catch (final IOException ee) {}
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

                    if( document.isEncrypted() )
                    {
                        try
                        {
                            StandardDecryptionMaterial sdm = new StandardDecryptionMaterial(password);
                            document.openProtection(sdm);
                        }
                        catch( InvalidPasswordException e )
                        {
                            if( args.length == 4 )//they supplied the wrong password
                            {
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

                {
                    document = PDDocument.load(pdfFile, force);
                    if( document.isEncrypted() )
                    {
                        StandardDecryptionMaterial sdm = new StandardDecryptionMaterial( password );
                        document.openProtection( sdm );
                    }
                }
               
                AccessPermission ap = document.getCurrentAccessPermission();
                if( ! ap.canExtractContent() )
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

                document = PDDocument.load(pdfFile);

                if (document.isEncrypted())
                {
                    StandardDecryptionMaterial spm = new StandardDecryptionMaterial(password);
                    document.openProtection(spm);
                }
            }
            AccessPermission ap = document.getCurrentAccessPermission();
            if (! ap.canExtractContent())
            {
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

            document = PDDocument.load(pdfFile);

            if (document.isEncrypted())
            {
                StandardDecryptionMaterial sdm = new StandardDecryptionMaterial(password);
                document.openProtection(sdm);
            }

            PrinterJob printJob = PrinterJob.getPrinterJob();
            printJob.setJobName(new File(pdfFile).getName());
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

                    }
                    else
                    {
                        decryptionMaterial = new StandardDecryptionMaterial(password);
                    }
                    document.openProtection(decryptionMaterial);
                    AccessPermission ap = document.getCurrentAccessPermission();
                    if(ap.isOwnerPermission())
                    {
                        document.setAllSecurityToBeRemoved(true);
                        document.save( outfile );
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

                    if( document.isEncrypted() )
                    {
                        try
                        {
                            StandardDecryptionMaterial sdm = new StandardDecryptionMaterial(password);
                            document.openProtection(sdm);
                        }
                        catch( InvalidPasswordException e )
                        {
                            if( args.length == 4 )//they supplied the wrong password
                            {
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

                if( doc.isEncrypted() )
                {
                    try
                    {
                        StandardDecryptionMaterial sdm = new StandardDecryptionMaterial(password);
                        doc.openProtection(sdm);
                        doc.setAllSecurityToBeRemoved(true);
                    }
                    catch( InvalidPasswordException e )
                    {
                        if (password.trim().length() == 0)
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.PDDocument.openProtection()

        {
            Assert.assertTrue(encryptedDoc.isEncrypted());
            PublicKeySecurityHandler securityHandler
                    = (PublicKeySecurityHandler) encryptedDoc.getEncryption().getSecurityHandler();
            securityHandler.setVerbose(true);
            encryptedDoc.openProtection(decryption2);
            fail("No exception when using an incorrect decryption key");
        }
        catch (IOException ex)
        {
            String msg = ex.getMessage();
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.