PHP code example of byggmann / php-pdf-merge
1. Go to this page and download the library: Download byggmann/php-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/ */
byggmann / php-pdf-merge example snippets
// Autoload composer classes...
// 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') // sets orientation automatically, "all" pages default
->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');