Question

Let's say I have stamp.pdf or stamp.html and original.pdf.

stamp.pdf (stamp.html) contains a stamp and I want to place stamp.pdf over original.pdf in a certain position and generate a new pdf - original_stamped.pdf

I would like to insert stamp.pdf as a pdf (vector graphic) or as html, but not converting to raster image and then insert into original_stamped.pdf

I am talking about stamping or watermarking (over the page), but not just adding an additional page to pdf.

Any ideas? Thanks!

Was it helpful?

Solution

Answer is something like that:

$pdf=new FPDI();
$pdf->addPage();

// Form
$pdf->setSourceFile('form.pdf'); // Specify which file to import
$tplidx = $pdf->importPage(1); // Import first page
$pdf->useTemplate($tplidx,0,0); // Position at 0,0 and use original page size

// Stamp
$pdf->setSourceFile('stamp.pdf'); // Specify which file to import
$tplidx2 = $pdf->importPage(1); // Import first page
$pdf->useTemplate($tplidx2,10,10,($pdf->w / 2)); // Position at 10,10 and resize to 50% of current page width

$pdf->Output(); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top