PDF - Insert
Declaration
<AMPDF ACTIVITY="insert" SESSION="text" SOURCE="text" PASSWORD="text (encrypted)" SAVETYPE="text (options)" DESTINATION="text" PDFDOCUMENTFROM="text (options)" NEWPDF="text" OVERWRITE="YES/NO" CREATEEMPTY="YES/NO" LOCATION="number" SOURCETYPE="text (options)" EXTRACTPDF="text" INSERTPASSWORD="text (encrypted)" IMAGEFILE="text" ISFITINTOPAGE="YES/NO" PAGE="number" />
Description
Inserts pages into a PDF file, sourced from extracted pages from another PDF file or an image file.
Practical usage
Used to add images to a PDF file or concatenate PDF files.
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 insert pages into 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 insert pages. 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. |
Data
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Type | Text (options) | Yes | SOURCETYPE="image" | The type of data to insert into a new or existing PDF file. The available options are:
|
|
Text | Yes, if Type is set to PDF | (Empty) | EXTRACTPDF="C:\temp\source.pdf" | The PDF path and file name of where to extract the pages. This parameter becomes active and is required if the Type parameter is set to PDF. | |
Password (optional) | Text | No | (Empty) | INSERTPASSWORD="AM5/WnwXFn7cFRyKCmf/d1l0Q==aME" | The password required to open the source PDF file (if required). |
Image | Text | Yes, if Type is set to Image | (Empty) | IMAGEFILE="C:\temp\source.png" | Specifies the path and file name of the source image to insert into the PDF file. Supported image formats are JPEG, TIFF, PNG, and BMP. This parameter becomes active and is required if the Type parameter is set to Image. |
Fit into page size | Yes/No | No | No | ISFITINTOPAGE="YES" | If selected, the source image will be resized to fit into the PDF page specified in the Insert at page parameter. If disabled, the source image will not be resized and, depending on its size, may not fit into the PDF page correctly. This parameter becomes active if the Type parameter is set to PDF. |
Extract page range | --- | Yes | All | --- | Specifies the pages to extract content from the source 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 |
Extract page(s) | Number | Yes, if Extract page range is set to Extract page(s) | (Empty) |
PAGE="1,3,5" |
If selected, specifies the pages to extract content from in the source PDF file. For a single page, enter the page number. Use a comma (,) to specify more than one page (for example, 1,3,5). Use a dash (-) to specify a range of pages (for example, 5-10). |
Insert at | --- | Yes | Last page | LOCATION="3" | Specifies the location of where to insert pages in the PDF file. The available options are:
|
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 example task extracts pages 1-3 from a PDF file and then inserts those pages at page 3 in different PDF file.
Copy
<AMPDF ACTIVITY="insert" SOURCE="C:\temp\savedForm.pdf" EXTRACTPDF="C:\temp\source.pdf" LOCATION="3" PAGE="1-3" />