0
我正在使用FPDI渲染PDF,其中包含PDF作爲背景,但希望在其上包含SVG文件,由於某些原因,在使用TCPDF庫時出現錯誤。是否有任何解決方法,或者我的代碼不正確。如何使用FPDI和TCPDF來實現ImageSVG()來呈現PDF?
(我把之前在 「ImageSVG」 和 「需要( 'tcpdf.php')」 行,這是完美的工作)
這裏是我的PHP代碼:
ob_clean();
ini_set("session.auto_start", 0);
define('FPDF_FONTPATH','font/');
define('FPDI_FONTPATH','font/');
require('fpdf.php');
require('fpdi.php');
require('tcpdf.php');
$pdf = new FPDI();
// let's get an id for the background template
$pdf->setSourceFile('/home/user/public_html'.$pdfName);
$backId = $pdf->importPage(1);
// iterate over all pages of HTML_Generated_pdf.pdf and import them
$pageCount = $pdf->setSourceFile('/home/user/public_html/wp-content/themes/myTheme/'.$filename.'.pdf');
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// add a page
$pdf->AddPage($specs['h'] > $specs['w'] ? 'P' : 'L', 'Letter');
// add the background
$pdf->useTemplate($backId);
// import the content page
$pageId = $pdf->importPage($pageNo);
// add it
$pdf->useTemplate($pageId);
$pdf->ImageSVG($file='images/EN-Logo.svg', $x=30, $y=100, $w='', $h=100, $link='', $align='', $palign='', $border=0, $fitonpage=false);
}
$pdf->Output($filename.'2.pdf', 'F');
錯誤我獲得:ImageSVG不是FPDI庫的一種方法。
我知道這個方法是我已經包含的TCPDF庫的一部分(第7行文本)。任何人都在意幫忙嗎?