This is my first time, i update this blog, after a long time not update it. In this time, i will try to share how to merger pdf using php script especially using PDFMerger library.


The first step to merger pdf file, download PDFMerger library here, after that create a php file, example 
pdfmerger.php


include 'PDFMerger/PDFMerger.php';
$pdf = new PDFMerger();
$pdf->addPDF('one.pdf') ->addPDF('two.pdf')
->addPDF('Three.pdf', 'all')
->merge('file', 'TEST2.pdf');
//REPLACE 'file' WITH 'browser', 'download', 'string', or 'file' for output options
//You do not need to give a file path for browser, string, or download - just the name.
?>

Before you run the above code, you must edit PDFMerger.php file, This file in folder PDFMerger and then find this code
if($fpdi->Output($outputpath, $mode))

and than, change the above code with this code

if($fpdi->Output($outputpath, $mode)=='')

If you did`nt it, will cause error like this

 'Error outputting PDF to 'file'.' in .....

But i have a problem when i used codeigniter, if you have solusion please share in this blog.

Title: How to merger pdf file using PDFMerger Library
Posted by faisal

Thanks for reading about How to merger pdf file using PDFMerger Library