PDF - Create

Declaration

<AMPDF ACTIVITY="create" TEXT="text" SETFONT="YES/NO" 
FONT="text (options)" SIZE="number" FORGROUNDCOLOR="text(options)" 
BACKGROUNDCOLOR="text(options)" LEFT="number" 
TOP="number" BOTTOM="number" RIGHT="number" 
DESTINATION="text" />

Description: Creates a new PDF document using plain text, text contained in a text file, HTML formatted text or text contained in an HTML document as the source data. When converting HTML formatted text, this activity renders the text according to its HTML tags, therefore, its appearance in the new PDF document would be displayed in the same HTML format as the source.

Practical Usage

Useful for embedding the contents of an existing HTML file to a new PDF to apply some new text formatting. Can also be used to easily and efficiently convert the contents of a text file to PDF.

Resource Parameters

Property

Type

Required

Default

Markup

Description

From

Text (options)

No

Plain text

  1. CREATEFROM="plain_text"

  2. CREATEFROM="html"

  3. CREATEFROM="text_file"

  4. CREATEFROM="html_file"

Specifies the original source data that should be converted to PDF. Different parameters may become available depending on the option selected. The available options are:

  • Plain text (default) - Plain text will be converted.

  • HTML- HTML text will be converted.

  • Text file - The data contained in a text file will be converted.

  • HTML file - The data contained in an HTML file will be converted.

Text

Text

Yes if From parameter is set to  Plain text

(Empty)

TEXT="thePlainText"

The text that should be converted to PDF. This parameter is active only if the From parameter is set to  Plain text.

HTML text

Text

Yes if From parameter is set to HTML text

(Empty)

  1. TEXT="theHTMLText"

The HTML formatted text that should be converted to PDF. This parameter is active only if the From parameter is set to HTML text.

Source

Text

Yes if From parameter is set to Text file or HTML file

(Empty)

  1. SOURCE="C:\theFile.txt

  2. SOURCE="C:\theFile.html

 

The path and file name of an existing text or HTML file that should be converted to PDF. This parameter is active only if the From parameter is set to Text file or HTML file.

PDF

Text

Yes if From parameter is set to Text file or HTML file

(Empty)

  1. DESTINATION="C:\newFile.pdf"

The path and filename in which to save the newly generated PDF file. Click the folder icon to open a standard Explorer dialog to navigate to the specified location or simply enter the full path and filename in the provided text box.

Overwrite if PDF already exists

Yes/No

No

No

OVERWRITE="YES"

If set to YES, any PDF file with the same name that already exists in the destination will be overwritten. If set to NO (default), any existing PDF file will not be overwritten, however, an error will occur as a result.

Advanced Parameters

Property

Type

Required

Default

Markup

Description

Set

Yes/No

No

No

SETFONT="YES"

Indicates whether modifications such as font typeface, size or color should be made to the original font style. This parameter is active only if the From parameter is set to  Plain text or Text file. It is set to NO by default.

Font

Text (options)

No

Segoe UI

FONT="Times New Roman"

The font typeface to set. The default value is Segoe UI. Click the down arrow to select from the drop-down list of available fonts. This parameter is active only if the Set parameter is set to YES.

Font size

Number

No

11

SIZE="10"

The size of the font to set. The default value is 11.This parameter is active only if the Set parameter is set to YES.

Text color

Text (options)

No

Black

FORGROUNDCOLOR="Blue"

The text color to set. The default value is Black. Click the down arrow to select from a drop-down list of available colors. This parameter is active only if the Set parameter is set to YES.

Background color

Text (options)

No

White

BACKGROUNDCOLOR="SeaShell"

The background color to set. The default value is White. Click the down arrow to select from a drop-down list of available colors. This parameter is active only if the Set parameter is set to YES.

Page Parameters

Property

Type

Required

Default

Markup

Description

Left

Text

No

10

LEFT="12"

Sets the left page margin in points/pixels. The default value is 10.

NOTE: 1 inch = 72 points/96 pixels.

Top

Text

No

50

Top="550"

Sets the top page margin in points/pixels. The default value is 50.

NOTE: 1 inch = 72 points/96 pixels.

Bottom

Text

No

50

Top="55"

Sets the bottom page margin in points/pixels. The default value is 50.

NOTE: 1 inch = 72 points/96 pixels.

Right

Text

No

10

Top="55"

Sets the right page margin in points/pixels. The default value is 10.

NOTE: 1 inch = 72 points/96 pixels.

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

Example

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

Description: Create PDF "C:\temp\sample.pdf" from text "the text". Set font, font size, destination, and overwrite existing file.

<AMPDF ACTIVITY="create" TEXT="the text" SETFONT="YES" 
SIZE="12" DESTINATION="C:\temp\sample.pdf" 
OVERWRITE="YES" />