[英]Adding images over PDF using FPDI and TCPDF
我正在嘗試在現有 PDF 之上添加圖像。
pdf 包含一個空白網格,我正在編寫一個腳本,該腳本將在 PDF 頂部插入圖像並輸出一個新的修改后的 PDF 文件。
我正在使用 FPDI 和 TCPDF 庫來加載和編輯 PDF 文件。
我嘗試使用 Write() 添加的任何圖像或文本; 和圖像(); 函數不會出現在輸出文件中的任何位置。
<?php // defining encoding and linking libraries header('Content-Type: text/html; charset=utf-8'); require_once('tcpdf/tcpdf.php'); require_once('fpdi/fpdi.php'); // Creating new page with PDF as a background $pdf = new FPDI(); $pdf->setSourceFile("resources/worksheet_template.pdf"); $tplIdx = $pdf->importPage(1); $pdf->AddPage(); $pdf->useTemplate($tplIdx, 0, 0, 0, 0, true); // $pdf->MultiCell(0, 5,'$pdf', 0, 'J', 0, 2, '', '', true, 0, false); $pdf->Image('resources/lantern.png', 50, 50, 100, '', '', 'http://www.tcpdf.org', '', false, 300); ob_clean(); $pdf->Output('WorksheetTest.pdf', 'I'); ?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.