Add Document Action
Contents
[
Hide
]
Add a document-open action
- Bind the source PDF to the
PdfContentEditorfacade. - Call
addDocumentAdditionalAction(...)with theDOCUMENT_OPENevent and the JavaScript action text. - Save the updated PDF document.
public static void addDocumentAction(Path inputFile, Path outputFile) {
PdfContentEditor editor = new PdfContentEditor();
try {
editor.bindPdf(inputFile.toString());
editor.addDocumentAdditionalAction(PdfContentEditor.DOCUMENT_OPEN, "app.alert('Document opened with PdfContentEditor action');");
editor.save(outputFile.toString());
} finally {
editor.close();
}
}