Performing a Basic Split

Introduction

APSplit’s default behavior is to extract each page from a PDF document and save it to a new file.  This chapter explains how to perform a default, or basic, split using different input scenarios. You will learn how to:

Splitting a PDF Document into Single Pages

To split one document into single pages, you only need to specify the input and output, as follows:

  • Input — The name of the PDF file you want to split.
  • Output — The -o option, followed by a PDF file name or a directory name. When you use a file name, the output file names are based on that name. When you use a directory name, the output file names are based on the input file name.

When specifying a directory name, include the ending slash: a back slash in Windows and a forward slash in UNIX and Macintosh operating systems. If you do not include the slash, the directory name will be interpreted as a file name. If the directory that you specify does not already exist, it will be created for you.

Note: APSplit does not automatically include annotations and article threads in the output PDF files it creates. If you want to save annotations, use the -keepannots option, described in Retaining Annotations.

Basic command

$ apsplit -o outPDFFileorDir [other options] inPDFFile

Example 1. Splitting to file name

Windows

> apsplit -o C:\Appligent\APSplit\output\BasicSplit.pdf C:\Appligent\APSplit\samples\SplitSample.pdf

UNIX/Macintosh

$ ./apsplit -o /Appligent/APSplit/output/BasicSplit.pdf /Appligent/APSplit/samples/SplitSample.pdf

Result

These example commands produce one-page files in the output directory, as shown in the following table. The output file names are created by adding the page number from the input file to the file name specified following the -o option.

Output File Name Page
BasicSplit.000001.pdf 1
BasicSplit.000002.pdf 2
BasicSplit.000003.pdf 3
BasicSplit.000000.pdf 000000, where 000000 is the last page

Example 2. Splitting to directory name

Windows

> apsplit -o C:\Appligent\APSplit\output\ C:\Appligent\APSplit\samples\SplitSample.pdf

UNIX/Macintosh

$ ./apsplit -o /Appligent/APSplit/output/ /Appligent/APSplit/samples/SplitSample.pdf

Result

These example commands produce one-page files in the output directory, as shown in the following table. The output file names are created by adding the page number from the input file to the input file name.

Output File Name Page
SplitSample000001.pdf 1
SplitSample000002.pdf 2
SplitSample000003.pdf 3
SplitSample.000000.pdf 000000, where 000000 is the last page

Splitting a Secured PDF Document

To split a secured document, you must specify the -d option, followed by the document’s Owner password. The Owner password, which is also called the Master or Permissions password, is required to modify and save the document.

Note: The User password (also called the Open password) does not work with APSplit. You must supply the Owner password.

Command

$ apsplit -d ownerpswd -o outPDFFileorDir [other options] inPDFFile

Example 1. Splitting to file name

Windows

> apsplit -d myownerpass -o C:\Appligent\APSplit\output\BasicSplit.pdf C:\Appligent\APSplit\samples\SplitSampleSecure.pdf

UNIX/Macintosh

$ ./apsplit -d myownerpass -o /Appligent/APSplit/output/BasicSplit.pdf /Appligent/APSplit/samples/SplitSampleSecure.pdf

Example 2. Splitting to directory name

Windows

> apsplit -d myownerpass -o C:\Appligent\APSplit\output\ C:\Appligent\APSplit\samples\SplitSampleSecure.pdf

UNIX/Macintosh

$ ./apsplit -d myownerpass -o /Appligent/APSplit/output/ /Appligent/APSplit/samples/SplitSampleSecure.pdf

Result

These examples use the -d option to supply the Owner password (myownerpass) required to open SplitSampleSecure.pdf. It then splits the document into one-page files, as described in Splitting a PDF Document into Single Pages.

Splitting Several PDF Documents at Once

To simultaneously split multiple documents into single pages, specify the input and output as follows:

  • Input — The names of all the PDF files to be split. If you want to split all of the PDF files in a directory, you may use the *.pdf wildcard specification as a shortcut.
    If any of the input files are secured, you must also specify the Owner password. However, only one Owner password may be included on a command. Secured files with different Owner passwords will not be split. A separate command must be submitted for each Owner password.
  • Output — The -o option, followed by a new or existing directory name. If the directory that you specify does not already exist, it will be created for you. The output files are placed in the specified directory and named by adding the page number from the input file to the input file name.
    Make sure the directory name includes the ending slash: a back slash in Windows and a forward slash in UNIX and Macintosh operating systems. If you do not include the slash, the directory name will be interpreted as a file name.

Command

$ apsplit -o outPDFDir [other options] inPDFFile [inPDFFile2...]

Example 1. Using full path names

Windows

> apsplit -o C:\Appligent\APSplit\output\ C:\Appligent\APSplit\samples\SplitSample1.pdf C:\Appligent\APSplit\samples\SplitSample2.pdf

UNIX/Macintosh

$ ./apsplit -o /Appligent/APSplit/output/ /Appligent/APSplit/samples/SplitSample1.pdf /Appligent/APSplit/samples/SplitSample2.pdf

Example 2. When one of the files is secured

Windows

> apsplit -d myownerpass -o C:\Appligent\APSplit\output\ C:\Appligent\APSplit\samples\SplitSample1.pdf C:\Appligent\APSplit\samples\SplitSampleSecure.pdf

UNIX/Macintosh

$ ./apsplit -d myownerpass -o /Appligent/APSplit/output/ /Appligent/APSplit/samples/SplitSample1.pdf /Appligent/APSplit/samples/SplitSampleSecure.pdf

Example 3. Substituting a wildcard shortcut

Windows

> apsplit -d myownerpass -o C:\Appligent\APSplit\output\ C:\Appligent\APSplit\samples\*.pdf

UNIX/Macintosh

 $ ./apsplit -d myownerpass -o /Appligent/APSplit/output/ /Appligent/APSplit/samples/*.pdf

Result

All of these example commands split multiple documents into single pages. Assuming that the directory specified in Example 3 contains three PDF files (SplitSample1.pdf, SplitSample2.pdf, and SplitSampleSecure.pdf), the following files would be extracted to the output directory:

  • from SplitSample1.pdf: SplitSample1.000001.pdf, SplitSample1.000002.pdf, SplitSample1.000003.pdf, and so on up to SplitSample1.nnnnnn.pdf, where nnnnnn is the last page number.
  • from SplitSample2.pdf: SplitSample2.000001.pdf, SplitSample2.000002.pdf, SplitSample2.000003.pdf, and so on up to SplitSample2.nnnnnn.pdf, where nnnnnn is the last page number
  • from SplitSampleSecure.pdf: SplitSampleSecure.000001.pdf, SplitSampleSecure.000002.pdf, SplitSampleSecure.000003.pdf, and so on up to SplitSampleSecure.nnnnnn.pdf, where nnnnnn is the last page number.