PDF - Split

Declaration

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

Related Topics

Description

Splits a PDF file 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 files. Developers can split a document at a specific page in order to save the valuable portion and discard the rest. Documents can be split into single pages allowing even more control during the editing process.

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 path and file name of the PDF to split. 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).

Output

Property Type Required Default Markup Description
Destination folder Text Yes (Empty) SPLITFOLDER="c:\temp" The path to the destination folder of where to output the newly split PDF files.
Type Text (options) Yes Split in half
  • SPLIT="half"
  • SPLIT="page"
  • SPLIT="even_odd"
  • SPLIT="split_at"
Specifies how to split the PDF file. The available options are:
  • Split in half (default) - The PDF file is split in half (or as close to half as possible) determined by the total number of pages in the document. The output files are named using the original file name, followed by the range of split pages enclosed in parenthesis (for example, myDocument (1-3).pdf, myDocument (4-6).pdf).
  • Split per page - The PDF file is split into individual pages. The output files are named using the original file name, followed by an underscore and page number (for example, myDocument_Page 1.pdf,  myDocument_Page 2.pdf, myDocument_Page 3.pdf, etc.).
  • Split by even odd - The PDF file is split into even and odd pages. The output files are named using original file name, followed by the page type, either even or odd (for example, myDocument_Even_Pages.pdf and myDocument_Odd_Pages.pdf).
  • Split at - The PDF file is split at the page specified. The output files are named using the original file name followed, by the range of pages split enclosed in parenthesis (for example, myDocument (1-2).pdf, myDocument (3-6).pdf).
Page number Number Yes if Type is set to Split at (Empty) PAGE="2" The page number of where to split the PDF file. This parameter becomes active and is required if the Type parameter is set to Split at.

Description

Error Causes

On Error

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.

Example 1

This sample task splits a PDF into even and odd pages and then stores the split files in a folder.

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

Example 2

This sample task splits a PDF at page 2 and then stores the split files in a folder.

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