PDF - Sign

Declaration

<AMPDF ACTIVITY="sign" SOURCE="text" PASSWORD="text (encrypted)" SAVETYPE="text (options)" DESTINATION="text" 
SIGNFILE="text" SIGN="text (options)" SIGNCONTACT="text" 
SIGNLOCATION="text" SIGNREASON="text" SIGNIMAGE="text" 
LEFTMARGIN="number" TOPMARGIN="number" WIDTH="number" 
HEIGHT="number" PAGE="number" VISIBLE="YES/NO" />

Description: Signs a PDF file with a Digital Certificate. You can specify the certificate level and set the graphical appearance of the signature.

Practical Usage

Digital signatures verify the signer's digital identity and enables enterprises to exchange documents electronically with assurance that the information has not been altered since it was sent. This activity allows you to sign a PDF file using signature fields.

Resource Parameters

Property

Type

Required

Default

Markup

Description

Resource

---

---

---

---

Indicates where the source PDF 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) - Specifies that the source PDF derives from a file located on the system. This option is normally chosen if only a single activity is required to complete an operation.

  • Session - Specifies that 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 options is normally chosen if a combination of activities within the same action group are required. Linking several activities to a single session eliminates redundancy and improves efficiency. Several sessions can exist in a single task. In addition, multiple sessions can run simultaneously without interference.

Session

Text

Yes if Resource parameter 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 parameter  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. The available options are:

  • Existing PDF (default) - This activity will be performed on an existing PDF document.

  • New PDF - This activity will be performed on a newly created PDF file.

Source PDF

Text

Yes if Use parameter is set to Existing PDF

(Empty)

SOURCE="C:\PDFFileName.pdf"

The path and filename of an existing PDF document to be used as the source. This parameter is active only if the Use parameter is set to Existing PDF.

Password (optional)

Text

Yes if Use parameter is set to Existing PDF

(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 Use parameter is set to 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 this activity 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 On Completion parameter is set to Save as

(Empty)

DESTINATION="C:\PDFFileName.pdf"

The new path and/or 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 Use parameter is set to New PDF

(Empty)

NEWPDF="C:\PDFFileName.pdf"

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

Signature Parameters

Property

Type

Required

Default

Markup

Description

Certificate

Text

Yes

(Empty)

SIGNFILE="C:\temp\certificateName.pfx"

The path and file name of a valid PKCS12 file that contains a certificate (CA-issued certificate or self-signed certificate) and a corresponding private key. This file has an extension of .pfx.  

Password

Text

No

(Empty)

CERTIFICATEPASSWORD="encrypted"

The certificate password.

Certificate type

Text (options)

No

pkcs1

  1. SIGN="pkcs1"

  2. SIGN="pkcs7"

  3. SIGN="pkcs7_detached"

The type of certificate to sign the PDF document with. The available options are:

  • PKCS1 (default) - Public-Key Cryptography Standards #1 defines mechanisms for encrypting and signing data using the RSA public-key cryptosystem.

  • PKCS7 - Public-Key Cryptography Standards #7 defines a general syntax for messages that include cryptographic enhancements such as digital signatures and encryption.

  • PKCS7 detached - Includes the signature and certificate without the signed data.

Contact

Text

Yes

(Empty)

SIGNCONTACT="Network Automation"

The signer's contact information.

Location

Text

Yes

(Empty)

SIGNLOCATION="Los Angeles"

The signer's location.

Sign reason

Text

Yes

(Empty)

SIGNREASON="secure exchange"

The reason for signing the document.

Signature appearance image

Text

No

(Empty)

SIGNIMAGE="c:\temp\signature.jpg"

If enabled, specifies the path and filename of an image file containing the signature to use. JPG, PNG and BMP type image files are supported. This parameter is disabled by default.

Advanced Parameters

Property

Type

Required

Default

Markup

Description

Left

Number

No

10

X="11"

The X (left) position of the signature. The default value is 10.

Top

Number

No

10

Y="11"

The Y (top) position of the signature. The default value is 10.

Width

Number

No

200

WIDTH="300"

The width of the image specified in points (note that 1 inch = 72 points and 1 inch = 96 pixels). The default value is 200.

Height

Number

No

200

HEIGHT="400"

The height of the image specified in points (note that 1 inch = 72 points and 1 inch = 96 pixels). The default value is 200.

Page number

Number

No

1

PAGE="2"

The PDF document  page to sign. The default value is1.

Signature visible

Yes/No

No

Yes

VISIBLE="NO"

If set to YES, the signature will be visible for others to view. If set to NO, the signature will be hidden. This parameter is set to YES by default.

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: Sign with certificate "c:\temp\cert.pfx". Sign (Contact="Network Automation", Location="Los Angeles", Reason="Just an example"). Sign position (X="15", Y="15", Width="300",Height="100"). Sign on page "1". Sign is visible. New PDF "c:\temp\newSignedPDF.pdf".

<AMPDF ACTIVITY="sign" PDFDOCUMENTFROM="new_file" 
NEWPDF="c:\temp\newSignedPDF.pdf" SIGNFILE="c:\temp\cert.pfx" 
SIGN="pkcs7" SIGNCONTACT="Network Automation" 
SIGNLOCATION="Los Angeles" SIGNREASON="Just an example" 
LEFTMARGIN="15" TOPMARGIN="15" 
WIDTH="300" HEIGHT="100" CERTIFICATEPASSWORD="AM2WMRHOVHCtfE=aME" />