PDF - Add Attachments
GPL GhostScript (32-bit) library is required to support PDF files.
Declaration
<AMPDF ACTIVITY="add_attachment" SOURCE="text" PASSWORD="text (encrypted)" SAVETYPE="text (options)" DESTINATION="text" FILENAME="text" DESCRIPTION="text" />
Description: Attaches one or more files to a PDF document. To specify more than one file, use wildcard characters (e.g., * or ?). To specify multiple files or wildcard masks, separate them with a pipe character (e.g., c:\*.txt|c:\*.bak).
Practical Usage
Used to enable a PDF document to carry attached files, just as e-mail messages can carry attached files. Attachments can contain a wide variety of information, and can be of a variety of file types. If you move the PDF document to a new location, the attachments move with it.
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:
|
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 |
|
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:
|
Source PDF |
Text |
Yes if using existing PDF |
(Empty) |
SOURCE="C:\PDFFileName.pdf" |
The path and filename of the PDF document in which files will be attached. 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 |
|
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:
|
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. |
Attachment
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Source |
Text |
Yes |
(Empty) |
|
The path and filename to attach. This can be a single file or multiple files or file masks. Wildcard characters (* or ?) may be used to attach files matching a certain mask. Multiple files or file masks may be entered by separating each entry with a pipe symbol (e.g., c:\*.txt|c:\*.bak). See File Masks & Wildcards for more details. |
Description (optional) |
Text |
No |
Text |
DESCRIPTION="Excel_attachments" |
An optional description to label the attached file(s). This value can be used to organize If the Source parameter is assigned to add multiple files, entering |
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
This sample task attaches a single Excel document to an existing PDF file. It attaches file "C:\temp\employees.xls" to PDF "C:\temp\sample1.pdf".
<AMPDF ACTIVITY="add_attachment" SOURCE="C:\temp\sample1.pdf" FILENAME="C:\temp\employees.xls" DESCRIPTION="Employee Master List" />
Sample 2
This sample task attaches all word documents found in a specific directory to a newly created PDF document.
<AMPDF ACTIVITY="add_attachment" PDFDOCUMENTFROM="new_file" NEWPDF="c:\temp\documents.pdf" FILENAME="C:\temp2\*.doc" DESCRIPTION="MS Word Documents Attached" />