Answers for "merge 2 pdf in php"

PHP
0

merge pdf php fpdf

<?php
require('fpdf_merge.php');

$merge = new FPDF_Merge();
$merge->add('doc1.pdf');
$merge->add('doc2.pdf');
$merge->output();
?>
Posted by: Guest on March-09-2021
0

merge 2 pdf in php

<?php 
    use setasign\Fpdi\Fpdi;

    require_once('fpdf/fpdf.php');
    require_once('FPDI/src/autoload.php');

    $files = ['pd1.pdf', 'resume-converted.pdf'];

    $pdf = new FPDI();

    // iterate over array of files and merge
    foreach ($files as $file) {
        $pageCount = $pdf->setSourceFile($file);
        for ($i = 0; $i < $pageCount; $i++) {
            $tpl = $pdf->importPage($i + 1, '/MediaBox');
            $pdf->addPage();
            $pdf->useTemplate($tpl);
        }
    }

    // output the pdf as a file (http://www.fpdf.org/en/doc/output.htm)
    $pdf->Output('F','save_path/merged.pdf');
?>
Posted by: Guest on August-11-2021

Browse Popular Code Answers by Language