Example usage for com.itextpdf.text.pdf PdfWriter ALLOW_PRINTING

List of usage examples for com.itextpdf.text.pdf PdfWriter ALLOW_PRINTING

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfWriter ALLOW_PRINTING.

Prototype

int ALLOW_PRINTING

To view the source code for com.itextpdf.text.pdf PdfWriter ALLOW_PRINTING.

Click Source Link

Document

The operation permitted when the document is opened with the user password

Usage

From source file:tutorials.encryptpdf.encryptpdf.java

public static void main(String[] args) {
    try {//from  w ww .  jav a 2 s .com
        PdfReader reader = new PdfReader("test.pdf");
        PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("encrypted.pdf"));
        stamper.setEncryption(null, null, PdfWriter.ALLOW_PRINTING,
                PdfWriter.ENCRYPTION_AES_256 | PdfWriter.DO_NOT_ENCRYPT_METADATA);
        stamper.close();
        reader.close();
    } catch (IOException | DocumentException ex) {
        ex.printStackTrace();
    }
}