PDF - Split

Declaration

<AMPDF ACTIVITY="split" SOURCE="text" PASSWORD="encrypted text" 
SPLITFOLDER="text" SPLIT="text (options)" PAGE="number" />

Description: Splits a PDF document in half, at a specific page, per individual page or into even/odd pages.

Practical Usage

Imagine a large report generated in PDF that needs to be divided  into pieces so specific portions can be sent to clients or other departments. The Split activity is ideal for such a task and allows for better management of PDF documents. Developers can split a document at a specific page to save the valuable portion and discard the rest. Documents can be split into single pages allowing even more control during the editing process.

Resource Parameters

Property

Type

Required

Default

Markup

Description

Resource

---

---

---

---

Indicates where the source PDF should originate from. This is a design mode parameter used only during task construction and configuration, thus, comprises no markup. The available options are:

  • File (default) - Specifies that the source PDF derives from a file located on the system. This option is normally chosen if only a single activity is required to complete an operation.

  • Session - Specifies that 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 options is normally chosen if a combination of activities within the same action group are required. Linking several activities to a single session eliminates redundancy and improves efficiency. Several sessions can exist in a single task. In addition, multiple sessions can run simultaneously without interference.

Session

Text

Yes if Resource parameter 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.

Source PDF

Text

Yes if Resource parameter is set to File

(Empty)

SOURCE="C:\temp\source.pdf"

The path and file name of an existing PDF document in which to extract contents from. This parameter is active only if the Use previously created session parameter is disabled.

Password (optional)

Text

Yes if Resource parameter is set to File

(Empty)

PASSWORD="encrypted"

The password required to open the existing PDF document (if required).

Output Parameters

Property

Type

Required

Default

Markup

Description

Destination folder

Text

Yes

(Empty)

SPLITFOLDER="c:\temp"

The path to the destination folder in which to output the newly split PDF files.

Type

Text (options)

No

Split in half

  1. SPLIT="half"

  2. SPLIT="page"

  3. SPLIT="even_odd"

  4. SPLIT="split_at"

The type of split that should be performed. The available options are:

  • Split in half (default) - The PDF document will be split in half (or as close to half as possible) determined by the total number of pages in the document. The output files will consist of the original filename followed by the range of pages that were split enclosed in parenthesis (e.g., myDocument (1-3).pdf, myDocument (4-6).pdf)

  • Split per page - The PDF document will be split into individual pages. The output files will consist of the original filename followed by an underscore and page number (e.g., myDocument_Page 1.pdf,  myDocument_Page 2.pdf, myDocument_Page 3.pdf, etc).

  • Split by even odd - The PDF document will be split into even and odd pages. The output files will consist of the original filename followed by the page type, either even or odd (e.g., myDocument_Even_Pages.pdf and myDocument_Odd_Pages.pdf).

  • Split at - The PDF document will be split at the page specified. The output files will consist of the original filename followed by the range of pages that were split enclosed in parenthesis (e.g., myDocument (1-2).pdf, myDocument (3-6).pdf).

Page number

Number

Yes if Type parameter is set to Split at

(Empty)

PAGE="2"

The page number that the split should occur on. This parameter is active only if the Type parameter is set to Split at.

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.)

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Example 1

Split existing PDF "C:\temp\myDocument.pdf" into even and odd pages. Store split files into folder "C:\temp".

<AMPDF ACTIVITY="split" SOURCE="C:\temp\myDocument.pdf" 
 SPLITFOLDER="C:\temp" SPLIT="even_odd" />

Example 2

Split existing PDF "C:\temp\myDocument.pdf" at page "2". Store split files into folder "C:\temp".

<AMPDF ACTIVITY="split" SOURCE="C:\temp\myDocument.pdf" 
 SPLITFOLDER="C:\temp" SPLIT="split_at" PAGE="2" />