Re: Help, FPDI is changing the size of my PDFs
| From: | Brian Dunning | Date: | Fri, 21 May 2010 19:14:31 +0000 |
| Subject: | Re: Help, FPDI is changing the size of my PDFs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-305406@lists.php.net to get a copy of this message | ||
Solved it. Here's the solution:
$pdf = new fpdi();
$pdf->setSourceFile('D:\\DocShare\\'.$filename);
$tplidx = $pdf->ImportPage(1);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L',
array($s['w'], $s['h'])); // This gets it the right dimensions
$pdf->useTemplate($tplidx, 0, 0, 0, 0, true);
$pdf->Output('newpdf.pdf', 'D');