PDFMerger created by Jarrod Nettles December 2009 jarrod@squarecrow.com
Updated by Vasiliy Zaytsev February 2016 vasiliy.zaytsev@ffwagency.com
I have made some changes in original codes to make PHPMerger compatible for PHP 5.
I tested with PHP 7.1 on my local machine and it still works.
FPDF and FPDI libraries replaced by TCPDF with TCPDI extension and parser.
require_once ('PDFMerger/PDFMerger.php');
use PDFMerger\PDFMerger;
$pdf = new PDFMerger;
$pdf->addPDF('a.pdf');
$pdf->addPDF('b.pdf');
$pdf->merge('download','merged.pdf');
include 'PDFMerger.php';
$pdf = new PDFMerger; // or use $pdf = new \PDFMerger; for Laravel
$pdf->addPDF('samplepdfs/one.pdf', '1, 3, 4');
$pdf->addPDF('samplepdfs/two.pdf', '1-2');
$pdf->addPDF('samplepdfs/three.pdf', 'all');
$pdf->merge('file', 'samplepdfs/TEST2.pdf'); // generate the file
$pdf->merge('download', 'samplepdfs/test.pdf'); // force download
// REPLACE 'file' WITH 'browser', 'download', 'string', or 'file' for output options