PDF Label Connector
PDF Label Connector
The PDF Label Connector supports generating PDF labels from XML via a PDF template.
PDF Label Connectors translate XML input into PDF output. XML element names are matched with form field names in the PDF template. The value of each XML element is pushed into the appropriate form field to generate the PDF output file.
This section contains all of the configurable connector properties.
Settings related to the core operation of the connector.
- Connector Id The static name of the connector. All connector-specific files are held in a folder by the same name within the Data Directory.
- Connector Description An optional field to provide free-form description of the connector and its role in the flow.
- Template File The PDF file that should be used as an output template. This file should have named fields that can be matched with incoming XML data, and these fields should be arranged in the desired format for all PDF files generated by the connector.
Settings related to the allocation of resources to the connector.
- Max Workers The maximum number of worker threads that will be consumed from the threadpool to process files on this connector. If set, overrides the default setting from the Profile tab.
- Max Files The maximum number of files that will be processed by the connector each time worker threads are assigned to the connector. If set, overrides the default setting from the Profile tab.
Settings not included in the previous categories.
- Send Filter A glob pattern filter that determines which files in the Send directory should be processed by the connector. Patterns will exclude matching files if the pattern is preceded by a minus sign:
Multiple patterns can be specified, comma-delimited, with later filters taking priority.
- Log Level The verbosity of logs generated by the connector. When requesting support, it is recommended to set this value to Debug.
- Log Messages Whether logs from processed files will include a copy of the file itself.
- Save to Sent Folder Whether files processed by the connector should be copied to the Sent folder for the connector.
Settings for specific use cases.
- Other Settings Allows configuration of hidden connector settings in a semicolon-separated list, like
setting1=value1;setting2=value2. Normal connector use cases and functionality should not require use of these settings.
Settings related to the automatic processing of files by the connector.
- Send Whether messages arriving at the connector will automatically be processed.
Generating a PDF Document
The PDF Label Connector reads XML input files and uses the data from these XML files to generate PDF documents that match the Template File PDF document. The structure of these XML input files should match the structure described below, or the legacy structure in the next section.
Here is an example of an XML input file, with an explanation provided below:
<Items> <PDF> <FormField1>Some data</FormField1> <BarcodeField type="code39">>5789337490548932</BarcodeField> </PDF> </Items>
As shown in the above example, the XML should match this structure:
- An Items element at the root
- A PDF child element representing a PDF document
- Inside the PDF element, an element that matches the name of each Form Field that should be dynamically populated with data
The names for each Form Field (i.e. the names to use for elements within the PDF element) come from the Template File PDF document. Whatever value is used to label the Form Fields in this template should be used as the element names to ensure the correct data is injected into the appropriate field in the resulting PDF.
If the Template File PDF contains multiple pages, the connector will automatically generate the appropriate number of pages when processing an XML input file. In addition, multiple copies of the Template File can be generated from a single XML file, in which case the additional copies are appended as multiple PDF pages for the same single output file.
To generate multiple copies of the Template File as a multi-page output, simply repeat the PDF element that is a direct child of the root Items element. Each PDF element at this position will be considered a separate instance of the Template File, and should contain all of the named Form Field values necessary to fill out the template.
Output a Subset of Pages
If the Template File PDF contains multiple pages, the connector supports generating a subset of these template pages by specifying the appropriate pages in the XML input file. The Items element at the root of the input document accepts a pages attribute with a comma-delimited list of the page numbers (zero-indexed) that should be included in the output.
For example, if the Template File contains 4 pages, and only the first and last page should be included in the output, the XML input file would look like this:
<Items pages="0,3"> <PDF> <FormField1>Some data</FormField1> </PDF> </Items>
Barcode Fields (Form Fields that should contain barcode data) are treated just like other Form Fields: the Barcode Field will have a label in the PDF template which should be used as the element name in the input XML. In addition, Barcode Fields should have a type attribute that determines the barcode type to generate. The connector supports four barcode types:
The numerical data for the barcode is then provided as the XML value for the appropriately named element.
Advanced Barcode Configuration
In addition to specifying the barcode type in the XML input file, the barcode can be configured directly in the PDF Template File. When creating/editing the Form Field that will hold the barcode, configuration information can be added to the Field ‘tooltip’ that will affect the resulting bar code. This configuration information should always have the following form:
The supported parameters for barcodes are as follows:
- barcode - the type of barcode (redundant when using the type attribute as described in the previous section)
- qrcodeversion - the version of the QR code when the barcode type is set to qrcode
- eclevel - the level of error correction when using a QR code; accepted values are ‘L’ (low), ‘M’ (medium), ‘Q’ (quartile), and ‘H’ (high).
- quietzone - a whitespace buffer surrounding the barcode; value should be an integer value representing a multiple of the smallest bar size (recommended value 10 or higher)
The following parameters are uncommon and should only be used for barcodes with special requirements:
- heightnarrowratio - the width of the narrowest bar in relation to the height of the barcode; must be specified as a ratio where height is 1 (e.g. ‘0.05’ for 1/20th)
- widenarrowratio - the width of the narrowest bar in relation to the width of the widest bar; must be specified as a ratio where the widest bar is 1 (e.g ‘0.2’ for 1/5th)
- spacebarratio - the width of a space in a barcode in relation to the width of the bar; must be specified as a ratio where the bar width is 1 (default value is 1)
Below is an example XML input file, PDF Template File, and resulting PDF output. Note that the image of the Template File PDF is taken from a PDF editor that displays the names of each Form Field:
<Items> <PDF> <From1>WAREHOUSE 5B</From1> <To1>CLEARING HOUSE 14C</To1> <CarrierRoutingBarcode type="code39">5789337490548932</CarrierRoutingBarcode> <CarrierRoutingNumber>5789337490548932</CarrierRoutingNumber> <CarrierName>Fedex</CarrierName> <PRO_num>12345</PRO_num> <BOL_num>54321</BOL_num> <PO_num>87E112CA</PO_num> <ProductID_num>EE12FUZZY</ProductID_num> <Quantity>4</Quantity> <POBarcode type="code39">99123445215586</POBarcode> <PO_num_2>99123445215586</PO_num_2> <Carton_num>1</Carton_num> <Carton_total>1</Carton_total> <LotID>8821445</LotID> <SSCCNumber>2709667490538981</SSCCNumber> <SSCCBarcode type="code39">2709667490538981</SSCCBarcode> </PDF> </Items>
Legacy XML Format
In addition to the XML format described above, the connector supports an older XML input file structure to maintain backwards compatibility. It is recommended to use the syntax from the previous section when designing new Flows.
Below is an example of the legacy XML format:
<Items> <Item name="BillAddressLine1">Wayne Tech Plant 1</Item> <Item name="BillAddressLine2">100 Wayne Ave.</Item> <Item name="BillAddressLine3">Chapel Hill, NC 27514</Item> <Item name="ShipAddressLine1">Same as billing address</Item> </Items>
In this structure, all children of the root Items element should be called Item, and the name XML attribute should match the Form Field name in the PDF Template File. The same XML attributes described in the previous sections are available in the legacy format (type for specifying barcode fields, pages for generating a subset of output pages, etc).