> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PDF Label Connector

> Configuration and usage guide for the CData Arc PDF Label connector.

export const SlasTab = ({siteName = "CData Arc"}) => <>
    <p><em>Settings related to configuring Service Level Agreements (SLAs).</em></p>
    <p>
      SLAs enable you to configure the volume you expect connectors in your flow to send or receive, and to set the time frame in which you expect that volume to be met. {siteName} sends emails to warn the user when an SLA is not met, and marks the SLA as <em>At Risk</em>, which means that if the SLA is not met soon, it will be marked as <em>Violated</em>. This gives the user an opportunity to step in and determine the reasons the SLA is not being met, and to take appropriate actions. If the SLA is still not met at the end of the at-risk time period, the SLA is marked as violated, and the user is notified again.
    </p>
    <p>
      To define an SLA, toggle <strong>Expected Volume</strong> on, then click the <strong>Settings</strong> tab.
    </p>
    <img src="/public/images/sla_empty.png" alt="SLA Empty" />
    <ul>
      <li>If your connector has separate send and receive actions, use the radio buttons to specify which direction the SLA pertains to.</li>
      <li>In the <strong>Expect at least</strong> portion of the window:
        <ul>
          <li>Set the minimum number of transactions you expect to be processed (the volume)</li>
          <li>Use the <strong>Every</strong> fields to specify the time frame</li>
          <li>Indicate when the SLA should go into effect. If you choose <strong>Starting on</strong>, complete the date and time fields.</li>
          <li>Check the boxes for the days of the week that you want the SLA to be in effect. Use the dropdown to choose <strong>Everyday</strong> if necessary.</li>
        </ul>
      </li>
      <li>In the <strong>Set status to 'At Risk'</strong> portion of the window, specify when the SLA should be marked as at risk.
        <ul>
          <li>By default, notifications are not sent until an SLA is in violation. To change that, check <strong>Send an 'At Risk' notification</strong>.</li>
        </ul>
      </li>
    </ul>
    <p>
      The following example shows an SLA configured for a connector that expects to receive 1000 files every day Monday-Friday. An at-risk notification is sent 1 hour before the end of the time period if the 1000 files have not been received.
    </p>
    <img src="/public/images/sla_defined.png" alt="SLA Configuration Example" />
    <Note>
      You can turn off SLA alerts if necessary. This can be useful during maintenance windows. Click <strong>Settings</strong> on the navbar, then navigate to <strong>Alerts &gt; General Alerts</strong>. Click the tablet and pencil icon to edit, and uncheck the <strong>SLA Alerts</strong> setting.
    </Note>
  </>;

export const AlertsTab = ({siteNameShort = "Arc"}) => <>
    <p><em>Settings related to configuring alerts.</em></p>
    <p>
      Before you can execute Service Level Agreements (SLAs), you need to set up email alerts for notifications. By default, {siteNameShort} uses the global settings on the <a href="/26.2/cloud/en/getting-started/administration/settings/alerts">Alerts</a> tab. To use other settings for this connector, toggle <strong>Override global setting</strong> on.
    </p>
    <p>
      By default, error alerts are enabled, which means that emails are sent whenever there is an error. To turn them off, uncheck the <strong>Enable</strong> checkbox.
    </p>
    <p>
      Enter a <strong>Subject</strong> (mandatory), then optionally enter a comma-separated list of <strong>Recipient</strong> emails.
    </p>
  </>;

export const MiscConnector = () => <>
    <p><em>Miscellaneous settings are for specific use cases.</em></p>
    <table>
      <thead>
        <tr>
          <th>Setting</th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><strong>Other Settings</strong></td>
          <td>Enables you to configure hidden connector settings in a semicolon-separated list (for example, <code>setting1=value1;setting2=value2</code>). Normal connector use cases and functionality should not require the use of these settings.</td>
        </tr>
      </tbody>
    </table>
  </>;

export const Logging = () => <>
    <p><em>Settings that govern the creation and storage of logs.</em></p>
    <table>
      <thead>
        <tr>
          <th>Setting</th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><strong>Log Level</strong></td>
          <td>The verbosity of logs generated by the connector. When you request support, set this to <strong>Debug</strong>.</td>
        </tr>
        <tr>
          <td><strong>Log Subfolder Scheme</strong></td>
          <td>Instructs the connector to group files in the Logs folder according to the selected interval. The <strong>Weekly</strong> option (which is the default) instructs the connector to create a new subfolder each week and store all logs for the week in that folder. Leaving this setting blank tells the connector to save all logs directly in the Logs folder. For connectors that process many transactions, using subfolders helps keep logs organized and improves performance.</td>
        </tr>
        <tr>
          <td><strong>Log Messages</strong></td>
          <td>Check this to have the log entry for a processed file include a copy of the file itself. If you disable this, you might not be able to download a copy of the file from the <strong>Transactions</strong> tab.</td>
        </tr>
      </tbody>
    </table>
  </>;

export const MacrosExamples = ({extraMacros = []}) => <>
    <p>
      Some macros, such as %Ext% and %ShortDate%, do not require an argument, but others do. All
      macros that take an argument use the following syntax: <code>%Macro:argument%</code>
    </p>

    <p>Here are some examples of the macros that take an argument:</p>

    <ul>
      <li>%Header:headername%: Where <code>headername</code> is the name of a header on a message.</li>
      <li>%Header:mycustomheader% resolves to the value of the <code>mycustomheader</code> header set on the input message.</li>
      <li>%Header:ponum% resolves to the value of the <code>ponum</code> header set on the input message.</li>
      <li>%RegexFilename:pattern%: Where <code>pattern</code> is a regex pattern. For example, <code>%RegexFilename:^([\w][A-Za-z]+)%</code> matches and resolves to the first word in the filename and is case insensitive (<code>test_file.xml</code> resolves to <code>test</code>).</li>
      <li>%Vault:vaultitem%: Where <code>vaultitem</code> is the name of an item in the <a href="/26.2/cloud/en/getting-started/administration/settings/global-settings-vault">vault</a>. For example, <code>%Vault:companyname%</code> resolves to the value of the <code>companyname</code> item stored in the vault.</li>
      <li>%DateFormat:format%: Where <code>format</code> is an accepted date format (see <a href="/26.2/cloud/en/scripting/value-formatters/date-formatters#sample-date-formats">Sample Date Formats</a> for details). For example, <code>%DateFormat:yyyy-MM-dd-HH-mm-ss-fff%</code> resolves to the date and timestamp on the file.</li>
      {extraMacros.filter(item => item.example).map(item => <li key={`ex-${item.name}`}>{item.example}</li>)}
    </ul>

    <p>You can also create more sophisticated macros, as shown in the following examples:</p>

    <ul>
      <li>Combining multiple macros in one filename: <code>%DateFormat:yyyy-MM-dd-HH-mm-ss-fff%%EXT%</code></li>
      <li>Including text outside of the macro: <code>MyFile_%DateFormat:yyyy-MM-dd-HH-mm-ss-fff%</code></li>
      <li>Including text within the macro: <code>%DateFormat:'DateProcessed-'yyyy-MM-dd_'TimeProcessed-'HH-mm-ss%</code></li>
    </ul>
  </>;

export const MacrosTable = ({siteName = "CData Arc", extraMacros = []}) => <>
    <p>
      Using macros in file naming strategies can enhance organizational efficiency and contextual
      understanding of data. By incorporating macros into filenames, you can dynamically include
      relevant information such as identifiers, timestamps, and header information, providing
      valuable context to each file.
    </p>

    <p>{siteName} supports these macros, which all use the following syntax: <code>%Macro%</code>.</p>

    <table>
      <thead>
        <tr><th>Macro</th><th>Description</th></tr>
      </thead>
      <tbody>
        <tr><td>ConnectorID</td><td>Evaluates to the ConnectorID of the connector.</td></tr>
        <tr><td>Ext</td><td>Evaluates to the file extension of the file currently being processed by the connector.</td></tr>
        <tr><td>Filename</td><td>Evaluates to the filename (extension included) of the file currently being processed by the connector.</td></tr>
        <tr><td>FilenameNoExt</td><td>Evaluates to the filename (without the extension) of the file currently being processed by the connector.</td></tr>
        <tr><td>MessageId</td><td>Evaluates to the MessageId of the message being output by the connector.</td></tr>
        <tr><td>RegexFilename:<em>pattern</em></td><td>Applies a RegEx pattern to the filename of the file currently being processed by the connector.</td></tr>
        <tr><td>Header:<em>headername</em></td><td>Evaluates to the value of a targeted header (<code>headername</code>) on the current message being processed by the connector.</td></tr>
        <tr><td>LongDate</td><td>Evaluates to the current datetime of the system in long-handed format (for example, Wednesday, January 24, 2024).</td></tr>
        <tr><td>ShortDate</td><td>Evaluates to the current datetime of the system in a yyyy-MM-dd format (for example, 2024-01-24).</td></tr>
        <tr><td>DateFormat:<em>format</em></td><td>Evaluates to the current datetime of the system in the specified format (<code>format</code>). See <a href="/26.2/cloud/en/scripting/value-formatters/date-formatters#date-formats-with-literal-characters">Sample Date Formats</a> for the available datetime formats.</td></tr>
        <tr><td>Vault:<em>vaultitem</em></td><td>Evaluates to the value of the specified vault item.</td></tr>
        {extraMacros.map(item => <tr key={item.name}>
            <td>{item.name}</td>
            <td>{item.description}</td>
          </tr>)}
      </tbody>
    </table>
  </>;

export const Performance = () => <>
    <p><em>Settings related to the allocation of resources to the connector.</em></p>
    <table>
      <thead>
        <tr>
          <th>Setting</th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><strong>Max Workers</strong></td>
          <td>The maximum number of worker threads consumed from the threadpool to process files on this connector. If set, this overrides the default setting on the <a href="/26.2/cloud/en/getting-started/administration/settings/performance-settings">Performance Settings</a> portion of the <a href="/26.2/cloud/en/getting-started/administration/settings/advanced-settings">Advanced Settings</a> page.</td>
        </tr>
        <tr>
          <td><strong>Max Files</strong></td>
          <td>The maximum number of files sent by each thread assigned to the connector. If set, this overrides the default setting on the <a href="/26.2/cloud/en/getting-started/administration/settings/performance-settings">Performance Settings</a> portion of the <a href="/26.2/cloud/en/getting-started/administration/settings/advanced-settings">Advanced Settings</a> page.</td>
        </tr>
      </tbody>
    </table>
  </>;

export const siteNameShort = "Arc";

export const siteName = "CData Arc";

The PDF connector supports generating rich visual business forms as PDF documents from XML, by using a PDF template.

## Key Capabilities

* PDF form generation from XML input using template-based field mapping
* Multi-page output support with selective page generation and barcode field integration
* Support for Code39, Code128, GS1-128, and QR code barcode types with advanced configuration

## Overview

PDF 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.

## Connector Configuration

This section contains all of the configurable connector properties.

### Settings Tab

#### Configuration

*Settings related to the core operation of the connector.*

| Setting                   | Description                                                                                                                                                                                                                                                                                                                       |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Connector Id**          | The static, unique identifier for the connector.                                                                                                                                                                                                                                                                                  |
| **Connector Type**        | Displays the connector name and a description of what it does.                                                                                                                                                                                                                                                                    |
| **Connector Description** | An optional field to provide a free-form description of the connector and its role in the flow.                                                                                                                                                                                                                                   |
| **Template File**         | The PDF file to use as an output template. This file must have form fields whose names match the incoming XML data. The fields must also be arranged in the format you want for all PDF files generated by the connector. The [Example](#example) below shows how the XML and the template file work together to generate output. |

#### Other Settings

| Setting               | Description                                                                                                                                                                                                                             |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Local File Scheme** | A scheme for assigning filenames to messages that are output by the connector. You can use macros in your filenames dynamically to include information such as identifiers and timestamps. For more information, see [Macros](#macros). |

### Advanced Tab

#### Other Settings

| Setting              | Description                                                                                                                                                                                                                                                                                                  |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Processing Delay** | The amount of time (in seconds) by which the processing of files placed in the **Transactions** tab is delayed. This is a legacy setting. Best practice is to [use a File connector](../flows/designing-a-flow#interacting-with-the-local-file-system) to manage local file systems instead of this setting. |

#### Logging

<Logging />

#### Miscellaneous

<MiscConnector />

### Automation Tab

#### Automation Settings

*Settings related to the automatic processing of files by the connector.*

| Setting  | Description                                                             |
| -------- | ----------------------------------------------------------------------- |
| **Send** | Whether messages arriving at the connector are automatically processed. |

#### Performance

<Performance />

### Alerts Tab

<AlertsTab />

### SLAs Tab

<SlasTab />

## Generating a PDF Document

The PDF connector reads XML input files and uses the data from these XML files to generate PDF documents that match the **Template File** PDF document specified on the [Settings tab](#settings-tab). The structure of these XML input files should match the structure described below, or the [legacy structure](#legacy-xml-format) described in the next section.

### XML Format

Here is an example of an XML input file:

```xml theme={null}
<Items>
  <PDF>
    <FormField1>Some data</FormField1>
    <BarcodeField type="code39">>5789337490548932</BarcodeField>
  </PDF>
</Items>
```

As shown in the example above, 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 (the names to use for elements in 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.

#### Multi-Page Outputs

If the template file PDF contains multiple pages, the connector automatically generates 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 is considered a separate instance of the template file, so it 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:

```xml theme={null}
<Items pages="0,3">
  <PDF>
    <FormField1>Some data</FormField1>
  </PDF>
</Items>
```

### Barcodes

Barcode fields (form fields that should contain barcode data) are treated just like other form fields: the barcode field has 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:

* code39
* code128
* gs1128
* qrcode

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 and editing the form field that holds the barcode, you can add configuration information to the field tooltip that affects the resulting bar code. This configuration information should always have the following form:

`$$parameter1:value,parameter2:value$$`

The following parameters are supported for barcodes:

* **barcode**: the type of barcode (redundant when using the *type* attribute 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. The value should be an integer value representing a multiple of the smallest bar size (with a 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 (for example, '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 (for example, '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)

## Example

Below is an example XML input file, PDF **Template File**, and resulting PDF output.

<Note>The template file image below is of the Adobe Pro form editor, which displays the names of each form field. Remember that the field names in the template file must match the element labels in the XML.</Note>

### Input XML

```xml theme={null}
<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>
```

### Template File

<img src="https://mintcdn.com/cdata-arc/AKthyJ-LnqphL8js/public/images/label_1010_screenshot.png?fit=max&auto=format&n=AKthyJ-LnqphL8js&q=85&s=15ac5a014c4462e14eeb558c61ef1221" alt="PDF Template" width="692" height="748" data-path="public/images/label_1010_screenshot.png" />

### Output

<img src="https://mintcdn.com/cdata-arc/AKthyJ-LnqphL8js/public/images/label_1010_filled.png?fit=max&auto=format&n=AKthyJ-LnqphL8js&q=85&s=a4dae6892460b112e12b097ce7d98f62" alt="PDF Sample" width="656" height="707" data-path="public/images/label_1010_filled.png" />

## Legacy XML Format

In addition to the XML format described in [Generating a PDF Document](#generating-a-pdf-document), the connector supports an older XML input file structure to maintain backwards compatibility. CData recommends that you use the syntax described in the previous section when designing new Flows.

Following is an example of the legacy XML format:

```xml theme={null}
<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 (such as *type* for specifying barcode fields, and *pages* for generating a subset of output pages).

## Macros

<MacrosTable />

### Examples

<MacrosExamples />
