I generate a pdf using FPDF/FPDI from 2 PDFs, and I use ghostscript to always convert to version 1.4 my pdf, because users download and sign the pdf locally, thus changing the version (FPDF works with version up to 1.4). The problem is that it overwrites my first page, after i added 13 records (allways at 13 record). I post bellow my function. Please help.
$pdfI = new \setasign\Fpdi\Fpdi();
//$pdfI->SetMargins(0,0,0);
$pdfI->SetAutoPageBreak(false);
file_put_contents("C:/xampp/htdocs/survey_v1/temp/tempInstruireSuplimentara.pdf",$row['file']);
shell_exec( 'gswin64 -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile="C:/xampp/htdocs/survey_v1/temp/temp2InstruireSuplimentara.pdf" "C:/xampp/htdocs/survey_v1/temp/tempInstruireSuplimentara.pdf"');
$pageCount = $pdfI->setSourceFile("C:/xampp/htdocs/survey_v1/temp/temp2InstruireSuplimentara.pdf");