1. Go to this page and download the library: Download tomsgu/pdf-merger-bundle 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/ */
tomsgu / pdf-merger-bundle example snippets
use Tomsgu\PdfMerger\PdfMerger;
class MergePdfs
{
private $merger;
public function __construct(PdfMerger $merger)
{
$this->merger = $merger;
}
public function mergePdfs()
{
$pdfCollection = new PdfCollection();
$pdfCollection->addPdf('filename.pdf', PdfFile::ALL_PAGES, PdfFile::ORIENTATION_PORTRAIT);
$pdfCollection->addPdf('filename2.pdf', '1-4,9', PdfFile::ORIENTATION_LANDSCAPE);
$pdfCollection->addPdf('filename3.pdf');
/**
* Available modes: MODE_FILE, MODE_DOWNLOAD, MODE_STRING, MODE_BROWSER
* Orientation: This is a fallback if the orientation wasn't specified when adding pdf.
*/
$this->merger->merge($pdfCollection, 'output.pdf', PdfMerger::MODE_FILE, PdfFile::ORIENTATION_LANDSCAPE);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.