PDF not merge greater than PDF-1.5 version using mPDF

You can previously downgrade input PDF file version with Ghostscript utility

gs \
  -sDEVICE=pdfwrite \
  -dCompatibilityLevel=1.4 \
  -o order_form_instructions_energy_supply_v1.4.pdf \
     order_form_instructions_energy_supply.pdf

and then use downgraded file in mPDF lib

Your script:

<?php
$mihir='<html>
<body>
Generate PDFs with merge
</body>
</html>';    

require_once("MPDF/mpdf.php");
$mpdf=new mPDF(); 
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; 
$mpdf->WriteHTML($mihir);

$mpdf->AddPage();
$mpdf->SetImportUse();

$cmd = 'gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -o order_form_instructions_energy_supply_v1.4.pdf order_form_instructions_energy_supply.pdf';
shell_exec($command);

$pagecount = $mpdf->SetSourceFile('order_form_instructions_energy_supply_v1.4.pdf');
$tplId = $mpdf->ImportPage($pagecount);
$mpdf->UseTemplate($tplId);
$mpdf->Output('test.pdf','D');

Rax: Have you tried with different pdf documents? This may help you: http://www.vankouteren.eu/blog/2009/07/fpdf-error-unable-to-find-xref-table/

One of the PDFs which should be merged was originally created from Word by a PDF creator which placed its signature in the properties of the PDF document. After removing this signature (in this case opening the PDF with Adobe Illustrator and saving it again) the problem was solved.

Tags:

Php

Mpdf