DocEvents Actions Gallery

Various actions can be assigned to events and run under conditions

Actions can be done on pages, records, or files when they are triggered by corresponding traversal operations. An action can be called to modify the target, such as adding a watermark to a page; to query about the target, such as extracting information from a certain place on page; to transform one data type to another, such as using a dataset to fill out a form thereby generating a new set of pages; to determine workflow, such as terminating an output file and starting a new one; and the list goes on. The freedom is given to the user to organize these “moving parts” into a custom-designed “machine”.

Most actions take parameters in the form of XML attributes, to fine-tune the behaviors. An action is not the same as the building blocks of a workflow, where it is the right to way is passed around so that different, coexisting threads are orchestrated in an orderly fashion. Rather, an actual thing is passed around among actual functions, each capable of doing something to the entity. As such, it is a perfect wedding between procedural and event-driven, object-oriented models. The architecture is more advantageous than a typical procedural program that is parable to a straight line from A to B; no matter how many parameters can be created to make the route more interesting, its nature doesn’t change.

docev1 Change properties

The following table summarizes the most frequently used actions provided by DocEvents processing framework. Each can be quite powerful despite its simplicity, for example the “Add page” action can be used to fuse multiple pages from an imported PDF into multiple target pages in each inbound page group.

Page-level actions
Add page Insert one or more pages into a given set of pages, or to fuse with those pages.
Drop page Delete one or more specified pages from a given page set or a file.
Change page Change the dimension, orientation, or other properties of a page.
Cache operations Put a page into cache, clear the cache, or other cache-related operations.
Output actions
PDF output Send a page or a page set to a designated PDF output receiver. Multiple instances of such receivers can coexist in a same job.
AFP output Send a page or page set to a designated AFP output receiver, best suitable for AFP recomposition processes.
CSV output Generate a set of records using current captured dataset and append to a given CSV file.
HTML output Create HTML output of the currently processed page.
Content operations
Change properties Change the color, position, and other properties of a set of selected contents.
Delete Remove selected contents from current page.
Insert Add new contents to current page.
Redact Mask selected text out from current page and replace them with black rectangles.
OMR Add automatic optical mark recognition (OMR) marks.
Imposition Impose multiple pages onto a new sheet of paper as a composite page.
Make form Define a selected set of contents as form and remove future occurrences from all pages, replaced with the newly defined form, so as to minimize data duplication.
Rasterize Convert a selected set of contents into a single image.
Form filling Use an inbound dataset to fill out a PDF form and then feed the filled and flattened pages downstream for further processing.
Page division Divide a large page into a set of smaller pages, each containing only a portion of the original page.
Metadata and utilities
Control flow Produce a decision so that the process may be terminated early, or the subsequent operations can be skipped for current set of input.
Increment counter Increment an internal counter, mainly used for sequential, multi-file output control.
Define target Define a point of interest for further processing, such as a bookmarked place.
Directories and files
PDF Merge Merge an input PDF into a given output PDF without going through content parsing, i.e. on physical level for maximum fidelity.
Zip output Add the current file or directory into a zip archive.
Move to folder Copy or move the current file into a new location


Events are associated with traversal of document hierarchy. Typically, an AFP document would contain logical documents, each document containing multiple page groups, and each page group containing multiple pages. Entering and exiting a structure are both considered events that can be attached with handlers. A document can also be iterated in other ways, for example, for a PDF document, bookmarks could be iterated instead. And for a CSV data source, the dataset are iterated.

About the Author: Cyphia