Blog : add existing pdfs to fpdf

add existing pdfs to fpdf

is there any function that I could call in order to inlcude an existing pdf in my fpdf file?

for example

$pdf->AddPage(from file example.pdf); .. something like that? is it posible?

fpdi is what you are looking for - see http://www.setasign.de/products/pdf-php-solutions/fpdi/

   
thnx.. i think thats it ... although i get this error: Warning: require_once(fpdf_tpl.php) [function.require-once]: failed to open stream help... –  NORM Jan 9 '11 at 7:53
   
you have to download both fpdi and fpdf_tpl (as stated here: setasign.de/products/pdf-php-solutions/fpdi/downloads) –  roman Jan 9 '11 at 8:00
   
thnx! whats a simple code to be able to add existing pdfs to my fpdf; because lets say I already have 2 pages inside my fpdf... using the code from fpdi it just overwrites both pages and makes only 1... any idea? –  NORM Jan 9 '11 at 8:17
   
import_page takes the number of the page to import as the first argument - simply import a second template for page 2 and use that on a new page –  roman Jan 9 '11 at 8:27
   
thnx! you are so much help!!!!! ... one last question :D ... is there any way to center text in the page? (in - $pdf->SetXY)because I have some $_POST arguments and dont know the exact length of wordr, so I have to make a default center for them... know how? –  NORM Jan 9 '11 at 8:39
show 2 more comments

up vote
0
down vote
to center text, just replace $pdf->Write(0, "".$person["ED"]); with Cell(0 , 0, $person["ED"], 0, 1, 'C');