I would use two differents pages from two differents PDF for create one PDF with both pages combines. For that I use FPDF and I have done this :
$finalPDF = new Fpdi();
$secondPDF = new Fpdi();
$personalizationPdfPath = "Path_of_my_first_PDF";
$templatePath = "Path_of_my_second_PDF";
$finalPDF->setSourceFile($templatePath);
$secondPDF->setSourceFile($personalizationPdfPath);
// Import the first page
$page1 = $pdfFinal->importPage(1, PdfReader\PageBoundaries::MEDIA_BOX);
// Import the second page of second PDF
$page2 = $secondPDF->importPage(2, PdfReader\PageBoundaries::MEDIA_BOX);
// Get the size
$dimension = $finalPDF->getTemplateSize($template_page);
// Add the page
$finalPDF->AddPage($dimension["orientation"], array($dimension["width"], $dimension["height"]));
// Apply the page1 on the finalPDF
$finalPDF->useTemplate($page1, 0, 0, $dimension["width"], $dimension["height"]);
// Apply the page2 on the finalPDF
$finalPDF->useTemplate($page2, 20, 28, $dimension["width"]*0.75, $dimension["height"]*0.75); //error
But when I run it, I have Template does not exist error. If I put $page1 instead of $page2 it work, both pages are combine. The first 100% size and second 75% size. I don't know why the $page2 not working. I have used dd(dump die) to see the difference between both $pages, nothing revelant.
So I use an alternative, transform the $page2 into a picture and use AddImage method :
$imageFromPDF = "Path_of_my_image.jpg";
$finalPdf->Image($imageFromPDF, 35, 35, $dimension["width"]*0.70, $dimension["height"]*0.70, "JPG");
$pdfFinal->Output("F", "nameOfPdf");
It works good, but the quality is bad. I have read this subject but the quality still trash.
On both way, anyone has a good solution ? Thanks