1

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...

Ravish
  • 2,383
  • 4
  • 37
  • 55
  • 1
    Glad you shared it with us! ;-) – maryisdead Aug 17 '11 at 13:03
  • 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 Aug 29 '11 at 21:49

2 Answers2

1

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."

space ranger
  • 422
  • 1
  • 8
  • 21
0
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.

Joel Johnson
  • 134
  • 7