Command aliases
The PDF Adapter works with Acrobat forms and templates to generate a PDF document or extract data from all or part of an input PDF document.
Use PDF as the adapter command alias on input and output card overrides and in
GET and PUT rules. For example:
| Input source override execution command | -IAPDF card_num |
| Output target override execution command | -OAPDF card_num |
Inbound adapter examples
Command line:
-U JohnDoe1040.pdf -S f1040.xsdGET rule:
=PARSE(GET("PDF", "-S f1040.xsd", BlobIn))Command line for reading
pages:
-U txredbook.pdf -PAGE 22-23
-U txredbook.pdf -PAGE 22Outbound adapter commands
Command line with template:
-U My1040.pdf -N f1040.names -P f1040.pdfPUT
rule:
=PUT("PDF", "-U My1040.pdf -N f1040.names -P f1040.pdf -T", Input)Enhanced PUT Method
XSL based PDF mode::
When the XSL property is specified with a non-null and non-empty value, the adapter operates in XSL based mode.
Processing Flow:
- The adapter retrieves the XSL stylesheet data from the specified URL. Supported URL protocols include file://, http://, and memory://.
XSL based Mode Processing
When the -XSL command is provided (non-null and non-empty) via
the command line parsing, the adapter automatically detects and enters XSL Based
Mode (Enable XSL PDF).The processing flow for XSL based mode is as
follows:
- The adapter retrieves the XSL stylesheet data from the location provided in the XSL File property.
- It uses the FopBridge class to perform the XSL-FO to PDF conversion.
- The generated PDF is output to the specified location using the -URL option.
Example Usage for FOP-based PDF generation:
To generate a PDF using Apache FOP, you must:
- Provide the XSL stylesheet via the
-XSLcommand line option. - Ensure the input XML data is compatible with the provided XSL stylesheet.
- Specify the output location using the
-URLoption.
Benefits and Capabilities
- Complex Layouts: Enables complex PDF layouts, formatting, advanced typography, and document structure controls through XSL.
- Rich Media: Successfully generates end-user expected PDF formats containing images and tables.
- Broad Functionality: Complements the existing AcroForm capabilities
and maintains compatibility with existing PDFBox-based adapter features.
Memory-based document handling (e.g.,
memory://) is fully supported for both input and output in this mode.
Example
The following example generates a PDF document using the XML data contained in
requestXML, applies the
table-style-invoice.xsl stylesheet to format the content, and
saves the output as
fop-invoice-1.pdf:
=PUT("PDF", "-URL fop-invoice-1.pdf -XSL table-style-invoice.xsl", PACKAGE(requestXML))Limitations and Notes
- Dependencies: This functionality requires the integration of the Apache FOP library for XSL based processing.
- Mutual Exclusivity: XSL based mode cannot be combined with certain AcroForm-specific parameters; they are mutually exclusive.