假设我有 stamp.pdf 或 stamp.html 和 original.pdf。
stamp.pdf (stamp.html) 包含一个图章,我想将 stamp.pdf 放在 original.pdf 上 在某个位置并生成一个新的 pdf - original_stamped.pdf
我想将 stamp.pdf 作为 pdf(矢量图形)或 html 插入,但不转换为光栅图像,然后插入到 original_stamped.pdf
我说的是加盖戳记或水印(在页面上),而不仅仅是向 pdf 添加额外的页面。
有什么想法吗?谢谢!
最佳答案
答案是这样的:
$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();
关于php Stamping - 使用另一个 pdf 或 html 为 pdf 加水印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16864782/