PdfMerger
in package
FinalYes
Combine multiple PDFs into one document.
Usage: PdfMerger::create() ->addFile('chapter1.pdf') ->addFile('chapter2.pdf') ->save('book.pdf');
Table of Contents
Methods
- addFile() : self
- addPages() : self
- addString() : self
- create() : self
- getSourceCount() : int
- getTotalPageCount() : int
- getVersionWarnings() : array<int, string>
- save() : void
- toBytes() : string
- Build the merged PDF.
Methods
addFile()
public
addFile(string $path[, string $password = '' ]) : self
Parameters
- $path : string
- $password : string = ''
Return values
selfaddPages()
public
addPages(string $path, PageSelector $pages[, string $password = '' ]) : self
Parameters
- $path : string
- $pages : PageSelector
- $password : string = ''
Return values
selfaddString()
public
addString(string $pdfBytes[, string $password = '' ]) : self
Parameters
- $pdfBytes : string
- $password : string = ''
Return values
selfcreate()
public
static create() : self
Return values
selfgetSourceCount()
public
getSourceCount() : int
Return values
intgetTotalPageCount()
public
getTotalPageCount() : int
Return values
intgetVersionWarnings()
public
getVersionWarnings() : array<int, string>
Return values
array<int, string>save()
public
save(string $path) : void
Parameters
- $path : string
toBytes()
Build the merged PDF.
public
toBytes() : string
Creates a new PdfFileWriter with a fresh page tree, then uses PageCopier for each source to deep-copy pages and their dependent objects (fonts, images, ExtGState, etc.) with reference remapping so cross-document object numbers do not collide.