The Merger component allows you to add PDF documents in 2 ways: It accepts a filename via the addFile() method or an existing document instance via the addDocument() method.
Both methods are nearly identical in their method signature. The only difference is that the one accepts a path to a file and the other accepts an existing document instance.
Description
public \setasign\SetaPDF2\Merger\Merger::addFile (
string|array $filenameOrConfig,
mixed $pages = null,
string|array $nameConfig = null,
null|string|array $outlinesConfig = null,
bool $copyLayers = true
):
?int Add a document by filename.
The document could include dynamic content like form fields, links or any other page annotation.
Form fields are handled especially:
If a document was added with form fields which names were already used by a previously added
document the field name will be suffixed with a slash and a number.
This behavior may lead to corrupted javascripts which may calculate field sums by field names!
Parameters
- $filenameOrConfig: string|array
The filename or config array. If an array is passed the keys has to be
named as the method parameters. All other parameters are optional then.
- $pages: mixed
The pages to add from the file. See
_checkPageNumber()
for a full description.
- $nameConfig: string|array
The configuration for a named destination for this file.
- $outlinesConfig: null|string|array
The outlines config,
- $copyLayers: bool
Whether to copy layer information of the document.
Exceptions
Throws \InvalidArgumentException