|
PDF - Add attachment(s) |
Declaration
<AMPDF ACTIVITY="add_attachment" SESSION="text" SOURCE="text" PASSWORD="text (encrypted)" SAVETYPE="text (options)" DESTINATION="text" PFDOCUMENTFROM="text (options)" NEWPDF="text" OVERWRITE="YES/NO" CREATEEMPTY="YES/NO" FILENAME="text" DESCRIPTION="text" />
Description
Attaches one or more files to a PDF file. To specify more than one file, use wildcard characters (for example, * or ?). To specify multiple files or file masks, separate them with a pipe character (for example, c:\file.txt|c:\file.xls).
Practical Usage
Used to enable a PDF file to carry attached files, just as email 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 file to a new location, the attachments move with it.
Parameters
Resource
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Resource | --- | --- | --- | --- | Specifies the source of the PDF file. The available options are:
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 |
|
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:
|
Source PDF | Text | Yes, if Use is set to Existing PDF | (Empty) | SOURCE="C:\PDFFileName.pdf" | The PDF path and file name of where to add the attachments. 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 |
|
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:
|
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. |
Attachment
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Source | Text | Yes | (Empty) |
|
The paths and file names of the attachments to add. This field supports single file, multiple files, or file masks entries. Wildcard characters (for example, * 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 (for example, c:\file.txt|c:\file.xls). |
Description (optional) | Text | No | Text | DESCRIPTION="Excel_attachments" | An optional description to label the attached files. |
Examples
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
Example 1
This sample task attaches an Excel document to an existing PDF file.
<AMPDF ACTIVITY="add_attachment" SOURCE="C:\temp\sample1.pdf" FILENAME="C:\temp\employees.xls" DESCRIPTION="Employee Master List" />
Example 2
This sample task attaches all Word documents found in a specific directory to new PDF file.
<AMPDF ACTIVITY="add_attachment" PDFDOCUMENTFROM="new_file" NEWPDF="c:\temp\documents.pdf" FILENAME="C:\temp2\*.doc" DESCRIPTION="MS Word Documents Attached" />