Skip to content

konnco/php-pdf-merge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Merge for PHP

PDF Merge library for PHP.

Forked from https://github.com/jurosh/php-pdf-merge

Install with composer:

composer require konnco/pdf-merge

Should add dependency:

"konnco/pdf-merge": "^2.0"

Highlights

Pdf merging with modes portrait/landscape or automatic mode.

Tested in Laravel 7 & Laravel 8 framework.

Usage

// Autoload composer classses...

// and now we can use library
$pdf = new \Konnco\PDFMerge\PDFMerger;

// add as many pdfs as you want
$pdf->addPDF('path/to/source/file.pdf', 'all', 'vertical')
  ->addPDF('path/to/source/file1.pdf', 'all', 'automatic')
  ->addPDF('path/to/source/file1.pdf', 'all')
  ->addPDF('path/to/source/file2.pdf', 'all', 'horizontal');

// call merge, output format `file`
$pdf->merge('file', 'path/to/export/dir/file.pdf');

That's it!

Enjoy and leave star if you like it :)