PDF - Add Header/Footer

Declaration

<AMPDF ACTIVITY="header_footer" SOURCE="text" 
PASSWORD="encrypted text" SAVETYPE="text (options)" 
DESTINATION="text" ADD="text (options)" IMAGE="text" WIDTH="number" 
HEIGHT="number" BOTTOMMARGIN="number" ALIGNMENT="text (options)" />

Description: Adds an image or text-based header or footer to a PDF document. 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 document which can be used to present consistent data, such as date, time, document title or company logo.

Resource Parameters

Property

Type

Required

Default

Markup

Description

Resource

---

---

---

---

Indicates where the source PDF document should originate from. This is a design mode parameter used only during task construction and configuration, thus, comprises no markup. The available options are:

  • File (default) - The source derives from a PDF file located on the system. This option is normally selected if only a single activity is required to complete the operation.

  • Session - The source PDF is obtained from a pre-configured session created in an earlier step with the use of the PDF - Create session activity. This option is normally selected if a combination of related activities are required to complete an operation. Consolidating several activities to a single session can eliminate redundancy. Moreover, a single task supports multi-session executions which can improve efficiency and speed up production.

Session

Text

Yes if Resource is set to Session

PDFSession1

SESSION="mySession"

The name of an existing session to associate this activity with. This parameter is active only if the Resource parameter is set to Session.

Use

Text (options)

Yes if Resource is set to File

Existing PDF

  1. PDFDOCUMENTFROM="existing_file"

  2. PDFDOCUMENTFROM="new_file"

Specifies whether this activity will be performed on an existing PDF document or on a new document. This parameter is active only if the Resource parameter is set to File.

  • Existing PDF (default) - Header/footer information will be embedded onto an existing PDF document.

  • New PDF - Header/footer information will be added to a newly created PDF file.

Source PDF

Text

Yes if using existing PDF

(Empty)

SOURCE="C:\PDFFileName.pdf"

The path and filename of the PDF document in which to insert a header/footer. This parameter is active only if the Use parameter is set to Existing PDF.

Password (optional)

Text

No

(Empty)

PASSWORD="encrypted"

The password required to open an existing PDF document (if required). This parameter is active only if the Use parameter is set to Existing PDF.

On completion

Text (options)

Yes if using existing PDF

Save

  1. SAVETYPE="save"

  2. SAVETYPE="do_not_save"

  3. SAVETYPE="save_as"

Specifies what action should be performed on the existing PDF file upon completion of this activity. This parameter is active only if the Use parameter is set to Existing PDF. The available options are:

  • Save (default) - Changes will be saved under the PDF document's original file name.

  • Do not save changes - Any changes made to the existing PDF document will not be saved.

  • Save As - Changes will be saved to a new path and filename.

Destination PDF

Text

Yes if set to Save As

(Empty)

DESTINATION="C:\PDFFileName.pdf"

The new path and filename in which to save a copy of the original PDF file. This parameter is active only if the On completion parameter is set to Save as.

New PDF

Text

Yes if creating new PDF

(Empty)

NEWPDF="C:\PDFFileName.pdf"

The path and filename in which to save the newly generated PDF document. This parameter is active only if the Use parameter is set to New PDF.

Overwrite if PDF already exists

Yes/No

No

No

OVERWRITE="YES"

If set to YES, files matching the name of the new PDF file will be overwritten. If set to NO, matching files will not be overwritten, however, a runtime error will occur as a result.  

Data Parameters

Property

Type

Required

Default

Markup

Description

Add

Text (options)

Yes

Header

  1. ADD="footer"

  2. ADD="header"

Specifies whether this activity will add header or footer information to the target PDF file. The available options are:

  • Header (default) - Header information will be added.

  • Footer - Footer information will be added.

Type

Text (options)

Yes

Text

  1. SOURCE="text"

  2. SOURCE="image"

Specifies the information type to add . This is a design time parameter which is linked directly with the Text or Image parameters below, therefore, no markups are available. The available options are:

  • Text (default) - Text-based information will be added. Selecting this option adds a Text parameter to allow the desired text to be entered. Also, additional text-based options become available in the Advanced properties.

  • Image - Image-based information will be added. Selecting this option  adds an Image parameter to allow selection of an existing image to be embedded. Also, additional image-based options become available in the Advanced properties.

Text

Text

Yes if Type parameter is set to Text

(Empty)

TEXT="theText"

The text to add. This parameter is active only if the Type parameter is set to Text.

Image

Text

Yes if Type parameter is 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 is active only if the Type parameter is set to Image.

Advanced Parameters

Property

Type

Required

Default

Markup

Description

Font

Text (options)

No

Segoe UI

FONT="Times New Roman"

The font typeface to be embedded. The available list box allows selection from a predefined list of fonts. The default value is Segoe UI. This parameters is active only if the Type parameter is set to Text.

Font size

Number

No

11

SIZE="10"

The size of the font to be embedded. The default value is 11. This parameters is active only if the Type parameter is set to Text.

Text color

Text (options)

No

Black

FORGROUNDCOLOR="Blue"

The color of the text to be embedded. The default value is Black. This parameters is active only if the Type parameter is set to Text.

Background color

Text (options)

No

White

BACKGROUNDCOLOR="SeaShell"

The background color to be embedded. The available list box allows selection from a predefined list of colors. The default value is White. This parameters is active only if the Type parameter is set to Text.

Left

Text

No

10

LEFT="12"

Sets the left page margin in points (note that 1 inch = 72 points and 1 inch = 96 pixels). The default value is 10. This parameters is active only if the Type parameter is set to Text.

Top

Text

No

50

TOP="55"

Sets the top page margin in points (note that 1 inch = 72 points and 1 inch = 96 pixels). The default value is 50. This parameters is active only if the Type parameter is set to Text.

Bottom

Text

No

50

BOTTOM="55"

Sets the bottom page margin in points (note that 1 inch = 72 points and 1 inch = 96 pixels). The default value is 50. This parameters is active only if the Type parameter is set to Text.

Right

Text

No

10

RIGHT="11"

Sets the right page margin in points (note that 1 inch = 72 points and 1 inch = 96 pixels). The default value is 10. This parameters is active only if the Type parameter is set to Text.

Width

Number

No

200

WIDTH="300"

The width of the image to be embedded specified in points (note that 1 inch = 72 points and 1 inch = 96 pixels). This parameters is active only if the Type parameter is set to Image.

Height

Number

No

200

HEIGHT="400"

The height of the image to be embedded specified in points (note that 1 inch = 72 points and 1 inch = 96 pixels). This parameters is active only if the Type parameter is set to Image.

Top/Bottom (position)

Number

No

10

CENTERMARGIN="12"

The center margin position of the header/footer specified in points (note that 1 inch = 72 points and 1 inch = 96 pixels.

Horizontal alignment

Text (options)

No

Center

  1. ALIGNMENT="center"

  2. ALIGNMENT="left"

  3. ALIGNMENT="right"

The horizontal alignment of the text relative to the header/footer. The available options are:

  • Center (default) - Text alignment will be set to the center of the header/footer.

  • Left - Text alignment will be set to the left portion  of the header/footer.

  • Right - Text alignment will be set to the right portion of the header/footer.

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Examples

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Sample 1

Text-based header - Add text "This is the header text" on header.  Set (Font="Tahoma", Font Size="10", Foreground Color="DarkBlue", Background color="SeaShell"). Header top margin= "11". Existing PDF "c:\temp\sourceDoc.pdf". Save PDF As "c:\temp\outputDoc.pdf".

<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" />

Sample 2

Image based footer - Add image "c:\temp\theImage.jpg" on footer. Footer bottom margin= "11". New PDF "C:\temp\theNewDoc.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" />