Example usage for com.itextpdf.text.pdf PdfReader getCryptoMode

List of usage examples for com.itextpdf.text.pdf PdfReader getCryptoMode

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfReader getCryptoMode.

Prototype

public int getCryptoMode() 

Source Link

Usage

From source file:com.qmetric.document.watermark.DefaultPdfStamperFactory.java

License:Open Source License

@Override
public PdfStamper newPdfStamper(final PdfReader pdfReader, final FileContent fileContent) {
    try {/* w ww .j  a v  a 2 s .c o m*/
        final PdfStamper pdf = new PdfStamper(pdfReader, fileContent.getOutputStream());

        if (pdfReader.isEncrypted()) {
            pdf.setEncryption(null, ownerPassword, pdfReader.getPermissions(), pdfReader.getCryptoMode());
        }

        return pdf;
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    } catch (com.itextpdf.text.DocumentException e) {
        throw new RuntimeException(e);
    }
}

From source file:uk.bl.wa.tika.parser.pdf.itext.PDFParser.java

License:Apache License

private static String getCryptoModeAsString(PdfReader reader) {
    int mode = reader.getCryptoMode();
    // TODO Make this into a more readable string, but tricky as it's a bitmask.
    // Need to use FLAG_A|FLAG_B output syntax, as strace does.
    // @see com.itextpdf.text.pdf.PDFEncryption.setCryptoMode(int mode, int kl);
    return "" + mode;
}