phpdftk API Documentation

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
self

addPages()

public addPages(string $path, PageSelector $pages[, string $password = '' ]) : self
Parameters
$path : string
$pages : PageSelector
$password : string = ''
Return values
self

addString()

public addString(string $pdfBytes[, string $password = '' ]) : self
Parameters
$pdfBytes : string
$password : string = ''
Return values
self

create()

public static create() : self
Return values
self

getSourceCount()

public getSourceCount() : int
Return values
int

getTotalPageCount()

public getTotalPageCount() : int
Return values
int

getVersionWarnings()

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.

Return values
string

        
On this page

Search results