Example usage for org.apache.pdfbox.pdmodel.interactive.action PDDocumentCatalogAdditionalActions getWP

List of usage examples for org.apache.pdfbox.pdmodel.interactive.action PDDocumentCatalogAdditionalActions getWP

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.interactive.action PDDocumentCatalogAdditionalActions getWP.

Prototype

public PDAction getWP() 

Source Link

Document

This will get a JavaScript action to be performed before printing a document.

Usage

From source file:org.apache.tika.parser.pdf.AbstractPDF2XHTML.java

License:Apache License

@Override
protected void endDocument(PDDocument pdf) throws IOException {
    try {/* ww  w  . ja  v a2 s .  com*/
        // Extract text for any bookmarks:
        extractBookmarkText();
        try {
            extractEmbeddedDocuments(pdf);
        } catch (IOException e) {
            handleCatchableIOE(e);
        }

        //extract acroform data at end of doc
        if (config.getExtractAcroFormContent() == true) {
            try {
                extractAcroForm(pdf);
            } catch (IOException e) {
                handleCatchableIOE(e);
            }
        }
        PDDocumentCatalogAdditionalActions additionalActions = pdf.getDocumentCatalog().getActions();
        handleDestinationOrAction(additionalActions.getDP(), ActionTrigger.AFTER_DOCUMENT_PRINT);
        handleDestinationOrAction(additionalActions.getDS(), ActionTrigger.AFTER_DOCUMENT_SAVE);
        handleDestinationOrAction(additionalActions.getWC(), ActionTrigger.BEFORE_DOCUMENT_CLOSE);
        handleDestinationOrAction(additionalActions.getWP(), ActionTrigger.BEFORE_DOCUMENT_PRINT);
        handleDestinationOrAction(additionalActions.getWS(), ActionTrigger.BEFORE_DOCUMENT_SAVE);
        xhtml.endDocument();
    } catch (TikaException e) {
        throw new IOExceptionWithCause("Unable to end a document", e);
    } catch (SAXException e) {
        throw new IOExceptionWithCause("Unable to end a document", e);
    }
}