0
votes

I have a doubt about using TCPDF and FPDI together. I am working on a project where I need to modify existing PDF file and generate new PDF, actually existing PDF are Greeting card template and I have to print certain data at certain pages (such as Image on first page, message on 3rd page, artwork on 4th page) to generate final PDF.

I googled and found with TCPDF, it is not possible to manipulate existing PDF, they suggested using FPDI for opening and manipulating existing PDF. That's where i am stuck. I need TCPDF (it methods to print images, transparent images, utf text, embed font etc) to do what I want to do, but, I need FPDI to start with. :(.

Please help me: is it possible to use both FPDI and TCPDF together? so that I can use features offered by both APIs ?

Thanks in advance...

2
Glad you shared it with us! ;-)maryisdead
How were you able to solve this? I can't seem to get access to the TCPDF functions when I import the PDF using FPDI and the documentation isn't that forthcoming. I'm trying to insert an image and change its Alpha value.Zigu

2 Answers

1
votes

http://www.setasign.de/products/pdf-php-solutions/fpdi/about/

"As of version 1.2.1 FPDI can be used with TCPDF - a derivate of FPDF."

0
votes
libraries_load('tcpdf');
libraries_load('fpdi');

$pdf = new FPDI();

$pdf->setSourceFile("%local_file_path%");

$tplIdx = $pdf->importPage(1);
$pdf->AddPage('L', array(3.5, 2), FALSE);
$pdf->useTemplate($tplIdx, 0, 0, 3.5, 2, false);

I was using Drupal at the time so I used libraries_load but require_once should work.