splitPdf

splitPdf

ADVANCED / PREMIUM TRIAL

Splits a PDF document.

Description
public splitPdf (string $source, string $target, [array $options])

This method allows you to split a PDF document.

Parameters

source

Path to the PDF document.

target

Path to the resulting split documents.

options

The possible keys and values are:

key Type Description
annotations bool Import annotations (links, comments and others). Default as false.
pages array Pages to be split. All by default.
useFixedAnnotationPositions bool Force annotation page link IDs. Useful when using PDF readers that don't detect all PDF contents automatically. Default as false.
Exceptions

File doesn't exist.

Code samples

Example #1

Release notes
  • phpdocx 16.0:
    • allow setting a custom path for the target files distinct than the source folder.
    • exceptions display the PDF file name if the source file doesn't exist.
    • supported versions of PDF/A model.
  • phpdocx 15.5:
    • cast to int object stream content indexes.
    • improved annotations support.
  • phpdocx 14.0:
    • useFixedAnnotationPositions option.
  • phpdocx 13.0:
    • improved working with indirect objects.
  • phpdocx 12.0:
    • improved annotations support.
  • phpdocx 10.0:
    • annotations option.
  • phpdocx 7.0:
    • new method.