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

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

Introduction

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

Prototype

public PDAction getWC() 

Source Link

Document

This will get a JavaScript action to be performed before closing 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 {/*from ww  w  .  j  a  v  a  2s.co m*/
        // 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);
    }
}