[PHP] Help, FPDI is changing the size of my PDFs

2010-05-21 Thread Brian Dunning
I'm using FPDI to add some stuff to some existing PDF documents. Works great, 
except that it's slightly changing the size of the PDF document (the physical 
page size, not the file size), which is unacceptable since this is for a 
high-end print file. I've stripped out all the code to the bare bones to try 
and debug this. Here is what I have:

$pdf = new fpdi();
$pdf-AddPage();
$pdf-setSourceFile('D:\\DocShare\\'.$filename);
$tplidx = $pdf-importPage(1);
$pdf-useTemplate($tplidx);
$pdf-Output('newpdf.pdf', 'D');

When I have PHP output the raw original PDF file, it measures 8.34x11.12. If 
I process it with the above code, the output measures 8.27x11.7 with a blank 
white band added along the bottom. Any suggestions? I just need the new file to 
be the same size as the original. Thanks!

Re: [PHP] Help, FPDI is changing the size of my PDFs

2010-05-21 Thread Brian Dunning
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');



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