Description

The PDFFileReceiver writes Domain Attribute values into a PDF file. Each generated record may be written to its own PDF file or as a page within a single PDF file. A configuration file may be used to format the created file(s). 


In This Article

 

Receiver Parameters

The following parameters can be defined for the PDFFileReceiver. Items with an asterisk (*) are required. 

  • *outputPath - The location where the output file will be stored. It defaults to the configured resource.output.directory path.
  • *outputSubDirectory - The prefix name of subdirectories that are auto-created under the outputPath and then appended with a number. (pdf1, pdf2, pdf3, etc.). These subdirectories will be created within your output directory path based on the filesPerOutputSubDir parameter.
  • *filesPerOutputSubDir - The number of files to be generated per output subdirectory.
  • fileNamePrefix - The prefix of the PDF file to be generated. If a value is entered here, it will be used to name each file within the created subdirectories (customer1, customer2, customer3, etc.).


  • configPath - The location where the PDF configuration file is stored on your local computer.
  • configSubDir - The subdirectory under the configPath directory where configuration and template files are stored.
  • configFileName - Name of the configuration file to be used for the PDFFileReceiver.
  • *filePerRow - Determines whether to create a new PDF file for each row of data or create a new page within the PDF file for each row of data. For example, if this is true and there are 30 rows of data, there will be 30 PDF files. If this is false, there will be one PDF file with 30 pages.


Receiver's Attribute Property Keys

The following Attribute Property Keys can be configured for each Attribute within a Domain for the Receiver: 

  • include - Determines if the Attribute will be included within the generated PDF file. Set to True by default.
  • columnName - Defines the display name for the Attribute within the PDF. It defaults to the Attribute name. 
  • data Type- This Property Key may be used to change how a value for an Attribute will appear within the generated PDF file. Data is selected by default.
    • data - The Attribute value will appear within the body of the PDF file. 
    • header - The Attribute value will appear as a header in the PDF file.
    • footer - The Attribute value will appear as a footer in the PDF file. When this option is selected, the Attribute value will appear in the bottom left corner of the PDF file.
    • fileNameSuffix - The Attribute value will be used as the suffix for the PDF file name.


Configuration File

A Configuration File can be used to gain increased flexibility over the style and design of the generated PDF file(s). The following Receiver Parameters are available when using a configuration file to format the generated PDF(s): 

  • configPath - Path where the file is stored.
  • configSubDir - Subdirectory within the file path where the configuration file is stored.
  • configFileName - Name of the configuration file.


Configuration File Properties

To use this feature for the PDFFileReceiver, you will need to create a configuration file with the one or more of the properties below:

  • headerFontType - Font type for the file header (Arial, Helvetica, etc.).
  • headerFontSize - Font size for the file header.
  • footerFontType - Font type for the file footer (Arial, Helvetica, etc.).
  • footerFontSize - Font size for the file footer.
  • dataFontType - Font type for the file data (Arial, Helvetica, etc.).
  • dataFontSize - Font size for the file data.
  • startX - X coordinate for the file. Defines where the data is displayed in the file (i.e., 300, 500, etc.).
  • startY - Y coordinate for the file. Defines where the data is displayed in the file (i.e., 300, 500, etc.).
  • leading - Leading spaces between the columnHeader and the value for each Attribute in the file.


The Font Type for the header, footer, and data can only be set to the following within the Configuration File:

TIMES_ROMAN
TIMES_BOLD
TIMES_ITALIC
TIMES_BOLD_ITALIC
HELVETICA
HELVETICA_BOLD
HELVETICA_OBLIQUE
HELVETICA_BOLD_OBLIQUE
COURIER
COURIER_BOLD
COURIER_OBLIQUE
COURIER_BOLD_OBLIQUE

Sample Configuration File

The following is an example configuration file showing the HTML format that defines the configuration file for a Domain. 

headerFontType=Helvetica_BOLD
headerFontSize=26
footerFontType=Arial
footerFontSize=12
dataFontType=Arial
dataFontSize=16
startX=100
startY=500
leading=25


Use Case 1 - Write Customer Data to Individual Pages within a Single PDF File

Customer data will be output to a single PDF file without using a configuration file. All Attribute property keys have their default configuration except the id Attribute, which has been set to "false" so that it is not in the generated output.



Receiver Parameters

The following configuration will generate one subdirectory titled pdf and create one PDF file titled Customer. Each record will be represented as a page within the PDF File.

  • outputSubDirectory - pdf will be entered. Use lowercase when entering a value here.
  • fileNamePrefix - Customer has been entered and will be the name of the PDF file.
  • filePerRow - The value will be set to false.


File Output

The following is the subdirectory and file created based on the configuration above:


In this example, 30 records were generated, with each record being a page within the file. The Attribute values are included in the body of the PDF.


Use Case 2 - Write Customer Data to a PDF File with Last Name in File Name

Domain Attribute values will be written to their own PDF file titled Customer+lastName within multiple subdirectories. 


Receivers Attribute Property Keys

The include property key will be set to false for the id Attribute. The id Attribute will not be displayed in the generated output.


The dataType property key for the lastName Attribute will be changed to fileNameSuffix.


Receivers Parameters

The following configuration will generate three subdirectories titled pdf1, pdf2, and pdf3. Each record will have its own PDF file within a subdirectory. The PDF file will have Customer as the prefix for the file name and the person's Last Name as the suffix for the file name.

  • outputSubDirectory - Each subdirectory will be titled pdf. Use lowercase when entering a value here.
  • filesPerOutputSubDir - 10 files will be generated per subdirectory.
  • fileNamePrefix - Each file will have Customer as the prefix for the name.
  • filePerRow - Left as "true" to generate 1 PDF file per record.


Output -  Subdirectories


Output - PDF Files


Use Case 3 - Generate a Single PDF File with the Customer's Last Name as the Page Header

A single PDF file will be generated as in Use Case 1. However, this time the lastName Attribute will be included as a page header, and all other information will be in the body of the file. 


Receiver Property Keys

The include property key will be set to false for the id Attribute. The id Attribute will not be displayed in the generated output.


The lastName Attribute data type property key has been set as "header."


File Output


Note: Setting an Attribute's dataType property key to footer works similar to above, except the Attribute will appear at the bottom of the page.


Use Case 4 - Write Customer Data to a Single PDF Using a Configuration File

In this example, 30 records will be written into a PDF file and formatted using a configuration file.


Receivers Property Keys

The include property key will be set to false for the id Attribute. The id Attribute will not be displayed in the generated output.


The dataType property key has been set to header for the lastName Attribute


The columnName property key has been updated to show a capitalized name for each Attribute other than id and lastName.



Configuration File

The following configuration file will be used for this story:

headerFontType=Helvetica_BOLD
headerFontSize=26
footerFontType=Arial
footerFontSize=12
dataFontType=Arial
dataFontSize=16
startX=10
startY=800
leading=25

Receiver Parameters

The configuration file resides in the output path: 


File Output

Each page will appear as shown below in this example: