PDF - Get attachment(s)

Declaration

<AMPDF ACTIVITY="extract_attachment" SESSION="text" SOURCE="text" PASSWORD="text (encrypted)" ATTACHMENTSDEST="text" FILENAME="text" SAVEMODE="text (options)" />

Related Topics

Description

Extracts all or specific file attachments and/or file annotations from a PDF file and then saves them to the desired location.

Practical Usage

Used to extract PDF file attachments and file annotations to a specified location in order to open or process them using subsequent activities.

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 the Resource parameter 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.
Source PDF Text Yes, if the Resource parameter is set to File (Empty) SOURCE="C:\temp\source.pdf" The PDF path and file name of where to extract file attachments and/or file annotations. This parameter becomes active and is required if the Resource parameter is set to File.
Password (optional) Text Yes, if the Resource parameter is set to File (Empty) PASSWORD="encrypted" The password required to open the existing PDF file (if required).

Attachment

Property Type Required Default Markup Description
Destination Text Yes (Empty) ATTACHMENTSDEST="c:\temp\folderName" The destination folder where the extracted file attachments and/or file annotations are saved.
If filename already exists Text (options) Yes Overwrite existing file
  • SAVEMODE="donotsave"
  • SAVEMODE="unique"

Specifies the action to take if files with the same file names as the extracted file attachments and/or file annotations already exist in the Destination folder. The available options are:

  • Do not save - Extracted files are not saved.
  • Save with unique file name - Extracted files are saved using the original file name, followed by an underscore and a unique number (for example, image001_1.png). The unique number in the file name increases sequentially if the previous unique file name still exists in the folder (for example, image001_1.png, image001_2.png).
  • Overwrite existing file (default) - Extracted files are saved by overwriting any files with the same file name.
Extract --- Yes All --- Specifies the file attachments and/or file annotations to extract. The available options are:
  • All - Extracts all file attachments and file annotations contained in the PDF file.
  • Specific file - Extracts one or more specified file attachments and/or file annotations contained in the PDF file.
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes.
Specific file Text Yes, if Extract is set to Specific file (Empty)

FILENAME="file.txt"

The file names of the file attachment and/or file annotations to extract. Click the folder icon to open the Attachment Browser which allows you browse and select files currently attached to the source PDF file or you can manually enter the desired file names in the provided text-box. Use a comma to delimit each entry (for example, file1.txt,file2.txt,fileA.png).

Description

Error Causes

On Error

Example

NOTE:
  • 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.

Description

This sample task extracts specific attachments from a PDF file and then stores them in a folder.

Copy
<AMPDF ACTIVITY="extract_attachment" SOURCE="C:\temp\sample.pdf" ATTACHMENTDEST="C:\temp101\" FILENAME="HR_Department.txt,process_info2.txt" />