PDF - Sign

Declaration

<AMPDF ACTIVITY="sign" SESSION="text" SOURCE="text" PASSWORD="text (encrypted)" SAVETYPE="text (options)" DESTINATION="text" PFDOCUMENTFROM="text (options)" NEWPDF="text" OVERWRITE="YES/NO" CREATEEMPTY="YES/NO" 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" CERTIFICATEPASSWORD="text (encrypted)" />

Related Topics

Description

Signs a PDF file with a Digital Certificate. 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.

Practical usage

Used for signing a PDF file by way of signature fields. The certificate level and the graphical appearance of the signature are customizable.

Parameters

Resource

Property Type Required Default Markup Description
Resource --- --- --- --- Specifies the source of the PDF file. 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 is 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.
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
  • PDFDOCUMENTFROM="existing_file"
  • PDFDOCUMENTFROM="new_file"
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:
  • Existing PDF (default) - Attachments are added to an existing PDF file.
  • New PDF - Attachments are added to a newly-created PDF file.
Source PDF Text Yes, if Use is set to Existing PDF (Empty) SOURCE="C:\PDFFileName.pdf" The path and file name of the PDF to sign. 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
  • SAVETYPE="save"
  • SAVETYPE="do_not_save"
  • SAVETYPE="save_as"
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:
  • Save (default) - Changes are saved under the PDF file's original file name.
  • Do not save changes - Any changes made to the existing PDF file are not saved.
  • Save As - Changes are saved to a new path and file name.
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 filename in the destination folder is overwritten when this activity runs. If disabled (default), a PDF file with the same filename 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.

Signature

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="text (encrypted)" The certificate password.
Certificate type Text (options) Yes PKCS1
  • SIGN="pkcs1"
  • SIGN="pkcs7"
  • SIGN="pkcs7_detached"
The type of certificate to use to sign the PDF file. 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="Fortra" The signer's contact information (for example, company name, email address, or phone number).
Location Text Yes (Empty) SIGNLOCATION="Los Angeles" The signer's location (for example, Los Angeles).
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 file name 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

Property Type Required Default Markup Description
Left Number Yes 10 LEFTMARGIN="11" The left margin position of the signature, specified in points. The default value is 10.
NOTE: 1 inch = 72 points/96 pixels.
Top Number Yes 10 TOPMARGIN="11" The top margin position of the signature, specified in points. The default value is 10.
NOTE: 1 inch = 72 points/96 pixels.
Width Number Yes 200 WIDTH="300" The width of the image, specified in points. The default value is 200.
NOTE: 1 inch = 72 points/96 pixels.
Height Number Yes 200 HEIGHT="400" The height of the image specified in points. The default value is 200.
NOTE: 1 inch = 72 points/96 pixels.
Page number Number Yes 1 PAGE="2" The PDF file  page to sign. The default value is 1.
Signature visible Yes/No No Yes VISIBLE="NO" If selected, the signature is visible for others to view. If disabled, the signature is hidden. This parameter is set to YES by default.

Description

Error Causes

On Error

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

This sample task signs a PDF file and then saves it using a different file name.

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