attachFile

attachFile

ADVANCED / PREMIUM TRIAL

Attaches files into a PDF document.

Description
public attachFile (string $source, string $target, mixed $file, [array $options])

Attaches files into a PDF document.

Parameters

source

Path to the PDF document.

target

Path to the output PDF.

file

string or array. Files to be attached.

options

The possible keys and values are:

key Type Description
annotations bool Import annotations (links, comments and others). Default as false.
extraXMPRDF array
  • useBaseXmpRdf (bool): default as true
  • xmp (string): XMP RDF content
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

Example #2

Release notes
  • phpdocx 16.0:
    • new method.