PHP code example of hubdesksa / pdf-merge
1. Go to this page and download the library: Download hubdesksa/pdf-merge library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hubdesksa / pdf-merge example snippets
// Autoload composer classses...
// and now we can use library
$pdf = new \Jurosh\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')
->addPDF('path/to/source/file2.pdf', 'all', 'horizontal');
// call merge, output format `file`
$pdf->merge('file', 'path/to/export/dir/file.pdf');