Example usage for com.itextpdf.text.pdf PdfAction SUBMIT_EXCL_NON_USER_ANNOTS

List of usage examples for com.itextpdf.text.pdf PdfAction SUBMIT_EXCL_NON_USER_ANNOTS

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfAction SUBMIT_EXCL_NON_USER_ANNOTS.

Prototype

int SUBMIT_EXCL_NON_USER_ANNOTS

To view the source code for com.itextpdf.text.pdf PdfAction SUBMIT_EXCL_NON_USER_ANNOTS.

Click Source Link

Document

a possible submitvalue

Usage

From source file:com.ideationdesignservices.txtbook.pdf.TxtBookPdf.java

public void zipPdf() {
    try {//from  ww  w  .  j  a v a2 s .  c om
        File srcFile = new File(Environment.getExternalStorageDirectory(), this.filename);
        if (srcFile.exists() && srcFile.canRead()) {
            String zipFilename = this.filename.replace(".pdf", ".zip");
            byte[] buffer = new byte[PdfAction.SUBMIT_EXCL_NON_USER_ANNOTS];
            ZipOutputStream zos = new ZipOutputStream(
                    new FileOutputStream(new File(Environment.getExternalStorageDirectory(), zipFilename)));
            FileInputStream fis = new FileInputStream(srcFile);
            zos.putNextEntry(new ZipEntry(srcFile.getName()));
            while (true) {
                int length = fis.read(buffer);
                if (length <= 0) {
                    zos.closeEntry();
                    fis.close();
                    zos.close();
                    this.filename = zipFilename;
                    return;
                }
                zos.write(buffer, 0, length);
            }
        }
    } catch (IOException ioe) {
        System.out.println("Error creating zip file" + ioe);
    }
}