I'm using FPDI to render a PDF that has a PDF set as a background, but want to include an SVG file on it, which for some reason gives me the error while using the TCPDF library along with it. Are there any workarounds, or my code incorrect.
(before I put in the "ImageSVG" and "require('tcpdf.php')" lines, it was working perfectly)
Here's my PHP code:
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');
The error I'm getting: ImageSVG not a method of FPDI library.
I know that this method is part of the TCPDF library, which I have already included (7th line of text). Anyone care to help?