PDF - Delete Attachment(s)
Declaration
<AMPDF ACTIVITY="delete_attachment" PDFDOCUMENTFROM="text" NEWPDF="text" FILENAME="text" />
Description: Removes one or more attachments embedded in a PDF document. To specify more than one attachment to delete, use a comma as a delimiter. An Attachment Browser is also provided allowing you to easily browse the files currently attached to the PDF document.
Practical Usage
Used to permanently delete all files or specific files that are attached to a PDF document.
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 Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Delete |
--- |
--- |
--- |
--- |
Determines the attachment(s) to delete. This is a design mode parameter used only during task construction and configuration, thus, comprises no markup. The available options are:
|
File name |
Text |
Yes if Delete parameter set to Specific file(s) |
(Empty) |
|
The filename(s) to delete. Click the folder icon to open the Attachment Browser which allows you browse and select attached files or manually enter the desired filename(s) in the provided text-box. Use a comma to delimit each entry (e.g., file1.txt,file2.txt,fileA.png) |
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 deletes all files attached to an existing PDF document. It deletes all attachments in PDF "C:\temp\sample.pdf".
<AMPDF ACTIVITY="delete_attachment" SOURCE="C:\temp\sample.pdf" />
Sample 2
This sample task deletes specific files attached to an existing PDF document. It deletes attached file "C:\temp\Sales_Department.txt,C:\temp\Tech_Department.txt,C:\temp\xml_sample_data.txt" from existing PDF "C:\temp\sample.pdf".
<AMPDF ACTIVITY="delete_attachment" SOURCE="C:\temp\sample.pdf" FILENAME="C:\temp\Sales_Department.txt, C:\temp\Tech_Department.txt,C:\temp\xml_sample_data.txt" />