Re: Adding a page with FPDF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brian Dunning wrote:
Anyone use FPDF?

I'm trying to create a new document in memory, starting with a template document - I'm going to add some stuff to it. The template document might be any size and dimensions. Here is the code I'm using, and my problem is that the resulting document is always an 8.5x11 page. How do I get my new document to be the same dimensions as the template doc?

$pdf= new fpdi();
$pagecount = $pdf->setSourceFile("templates/".$pdf_template_name);
$tplidx = $pdf->ImportPage(1);
$pdf->addPage('P');
$pdf->useTemplate($tplidx);


I think you have to specify the page size when you create the $pdf variable. Here's how I've been using it:

$pdf = new fpdi('P','pt','letter');

You might be able to use the FPDF_TPL::getTemplateSize() method to figure it out dynamically somehow though:

http://www.setasign.de/support/manuals/fpdf-tpl/fpdf-tpl/fpdf-tpl-gettempaltesize/

It also looks like the useTemplate method might do some legwork for you, but I'd have to test...

http://www.setasign.de/support/manuals/fpdf-tpl/fpdf-tpl/fpdf-tpl-usetemplate/

HTH

--
Ray Hauge
www.primateapplications.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux