3

假设我有stamp.pdfstamp.htmloriginal.pdf

stamp.pdf ( stamp.html ) 包含一个图章,我想将stamp.pdf放在original.pdf上的某个位置并生成一个新的 pdf - original_stamped.pdf

我想将stamp.pdf作为 pdf(矢量图形)或 html 插入,但不转换为光栅图像,然后插入original_stamped.pdf

我说的是印章或水印(在页面上),而不仅仅是在 pdf 中添加额外的页面。

有任何想法吗?谢谢!

4

1 回答 1

4

答案是这样的:

$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(); 
于 2013-06-06T12:16:36.787 回答