1<?php
2 use setasign\Fpdi\Fpdi;
3
4 require_once('fpdf/fpdf.php');
5 require_once('FPDI/src/autoload.php');
6
7 $files = ['pd1.pdf', 'resume-converted.pdf'];
8
9 $pdf = new FPDI();
10
11 // iterate over array of files and merge
12 foreach ($files as $file) {
13 $pageCount = $pdf->setSourceFile($file);
14 for ($i = 0; $i < $pageCount; $i++) {
15 $tpl = $pdf->importPage($i + 1, '/MediaBox');
16 $pdf->addPage();
17 $pdf->useTemplate($tpl);
18 }
19 }
20
21 // output the pdf as a file (http://www.fpdf.org/en/doc/output.htm)
22 $pdf->Output('F','save_path/merged.pdf');
23?>
1<?php
2require('fpdf_merge.php');
3
4$merge = new FPDF_Merge();
5$merge->add('doc1.pdf');
6$merge->add('doc2.pdf');
7$merge->output();
8?>