|
PDF - Add header/footer |
Declaration
<AMPDF ACTIVITY="header_footer" SESSION="text" SOURCE="text" PASSWORD="text (encrypted)" SAVETYPE="text (options)" DESTINATION="text" PDFDOCUMENTFROM="text (options)" NEWPDF="text" OVERWRITE="YES/NO" CREATEEMPTY="YES/NO" ADD="text (options)" TEXT="text" IMAGE="text" WIDTH="number" HEIGHT="number" FONT="text (options)" SIZE="number" FOREGROUNDCOLOR="text (options)" BACKGROUNDCOLOR="text (options)" CENTERMARGIN="number" BOTTOMMARGIN="number" ALIGNMENT="text (options)" />
Description
Adds an image or text-based header or footer to a PDF file. Advanced text preferences include the ability to modify a text string's font name, type, style, size or color. Image-based preferences allows re-sizing and alignment of an image.
Practical Usage
Commonly used to add header or footer information to a new or existing PDF file which is used to present consistent data, such as date, time, document title, or company logo.
Parameters
Resource
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Resource | --- | --- | --- | --- | Specifies the source of the PDF file. The available options are:
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes. |
Session | Text | Yes, if Resource is set to Session | PDFSession1 | SESSION="mySession" | The existing session to associate with this activity. This parameter becomes active and is required if the Resource parameter is set to Session.. |
Use | Text (options) | Yes, if Resource is set to File | Existing PDF |
|
Specifies
whether to add attachments to an existing or newly-created PDF file. This parameter becomes active and is required if the
Resource parameter is
set to File. The available options are:
|
Source PDF | Text | Yes, if Use is set to Existing PDF | (Empty) | SOURCE="C:\PDFFileName.pdf" | The PDF path and file name of where to add a header or footer. This parameter becomes active and is required if the Use parameter is set to Existing PDF.. |
Password (optional) | Text | No | (Empty) | PASSWORD="encrypted" | The password required to open the existing PDF file (if required). This parameter becomes active if the Use parameter is set to Existing PDF. |
On completion | Text (options) | Yes, if Use is set to Existing PDF | Save |
|
Specifies how changes to the PDF file are saved upon completion of this activity. This parameter becomes active and is required if the Use parameter is set
to Existing PDF. The available
options are:
|
Destination PDF | Text | Yes, if On completion is set to Save as | (Empty) | DESTINATION="C:\PDFFileName.pdf" | The path and file name where the modified existing PDF file is stored. This parameter becomes active and is required if the On completion parameter is set to Save as. |
New PDF | Text | Yes, if Use is set to New PDF | (Empty) | NEWPDF="C:\PDFFileName.pdf" | The path and file name where the newly-generated PDF file is stored. This parameter becomes active and is required if the Use parameter is set to New PDF |
Overwrite if PDF already exists | Yes/No | No | No | OVERWRITE="YES" | If selected, a PDF file with the same file name in the destination folder is overwritten when this activity runs. If disabled (default), a PDF file with the same file name in the destination folder is not overwritten, however, a runtime error occurs as a result. |
Create empty PDF file | Yes/No | No | No | CREATEEMPTY="YES" | If selected, the activity creates an empty, single-page PDF file. This parameter becomes active if the Use parameter is set to New PDF. |
Data
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Add | Text (options) | Yes | Header |
|
Specifies
whether to add a header or footer to the PDF file. The available options are:
|
Type | Text (options) | Yes | Text | --- | Specifies
the type of header or footer to add to the PDF file. The available options are:
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes. |
Text | Text | Yes, if Typeis set to Text | (Empty) | TEXT="theText" | The header or footer text to add. This parameter becomes active and is required if the Type parameter is set to Text. |
Image | Text | Yes, if Typeis set to Image | (Empty) | IMAGE="C:\ImageFile.jpg" | The path and file name of the image file to add. Supported image types are JPG, PNG, and BMP files. This parameter becomes active and is required if the Type parameter is set to Image. |
Advanced
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Font | Text (options) | Yes, if Type is set to Text | Segoe UI | FONT="Times New Roman" | The font typeface to use in the header or footer. The available list box allows selection from a predefined list of fonts. The default value is Segoe UI. This parameter becomes active and is required if the Type parameter is set to Text. |
Font size | Number | Yes, if Type is set to Text | 11 | SIZE="10" | The size of the font to use in the header or footer. The default value is 11. This parameter becomes active and is required if the Type parameter is set to Text. |
Text color | Text (options) | Yes, if Type is set to Text | Black | FORGROUNDCOLOR="Blue" | The color of the text to use in the header or footer. The default value is Black. This parameter becomes active and is required if the Type parameter is set to Text. |
Background color | Text (options) | Yes, if Type is set to Text | White | BACKGROUNDCOLOR="SeaShell" | The background color to use in the header or footer. The available list box allows selection from a predefined list of colors. The default value is White. This parameter becomes active and is required if the Type parameter is set to Text. |
Width | Number | Yes, if Type is set to Image | 200 | WIDTH="300" | The
width of the header or footer image, specified in points. The default value is 200. This parameter becomes active and is required if the Type
parameter is set to Image. NOTE: 1 inch = 72 points/96 pixels. |
Height | Number | Yes, if Type is set to Image | 200 | HEIGHT="400" | The
height of the header or footer image, specified in points. The default value is 200. This parameter becomes active and is required if the Type
parameter is set to Image. NOTE: 1 inch = 72 points/96 pixels. |
Top | Number | Yes | 10 | CENTERMARGIN="12" | The
center margin position of the header, specified in points. The default value is 10. NOTE: 1 inch = 72 points/96 pixels. |
Bottom | Number | Yes | 10 | BOTTOMMARGIN="12" | The bottom margin position of the footer, specified in points. The default value is 10. NOTE: 1 inch = 72 points/96 pixels. |
Horizontal alignment | Text (options) | Yes | Center |
|
The
horizontal alignment of the header or footer text. The available options are:
|
Examples
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
Example 1
This sample task adds a text-based header to a PDF file and then saves it using a different file name.
<AMPDF ACTIVITY="header_footer" SOURCE="c:\temp\sourceDoc.pdf" PASSWORD="AM2TsRNOVHCtfE=aME" SAVETYPE="save_as" DESTINATION="c:\temp\outputDoc.pdf" TEXT="This is the header text" FONT="Tahoma" SIZE="10" FORGROUNDCOLOR="DarkBlue" BACKGROUNDCOLOR="SeaShell" CENTERMARGIN="11" ALIGNMENT="left" />
Example 2
This sample task adds an image-based footer to a new PDF.
<AMPDF ACTIVITY="header_footer" PDFDOCUMENTFROM="new_file" NEWPDF="C:\temp\theNewDoc.pdf" ADD="footer" IMAGE="c:\temp\theImage.jpg" WIDTH="300" HEIGHT="100" BOTTOMMARGIN="11" ALIGNMENT="right" />