Re: Adding a page with FPDF
| From: | Ray Hauge | Date: | Wed, 18 Jun 2008 23:56:26 +0000 |
| Subject: | Re: Adding a page with FPDF | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275552@lists.php.net to get a copy of this message | ||
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