mergePdf
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
mergePdf
![](/img/preview/methods_check.png)
![](/img/preview/methods_X.png)
Merges two or more PDF documents.
Description
public mergePdf (array $documentArray, string $finalDocument, [array $options])
This method allows the full merging of PDF documents.
Parameters
documentArray
Paths array of the PDF documents to merge.
finalDocument
The destination path of the merged file.
options
The possible keys and values are:
key | Type | Description |
---|---|---|
annotations | bool | Import annotations (links, comments and others). Default as false. |
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.
Missing array.
Release notes
- 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 8.5:
- stream mode.
- removed a PHP warning message merging Index elements using PHP 7.2 or newer.
- phpdocx 8.5:
- stream mode.
- removed a PHP warning message merging Index elements using PHP 7.2 or newer.
- phpdocx 7.0:
- supported PDF 1.5, 1.6 and 1.7 versions.