[nycphp-talk] FPDF/FPDI template size too small
David Mintz
dmintz at davidmintz.org
Fri Jun 30 15:59:39 EDT 2006
I am not sure what if anything you might be doing wrong, but a few months
ago I gnawed on the demo/example that ships with the Fpdi class until I
got it to open a PDF doc test_pdf.pdf and generate a new one using
test_pdf.pdf as a template, with some text inserted in a specific
position. (this is substantially the same snippet I put out here a few
weeks ago in response to another question, sorry for the redundancy). If I
remember correctly, the demo (before I hacked it up) explicitly resets the
dimensions -- you don't want to do that. HTH.
define('FPDF_FONTPATH','../font/');
require('./fpdi.php');
$pdf= new fpdi();
$pdf->setTextColor(255,0,0);
$pdf->setSourceFile("./test_pdf.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx);
$pdf->SetXY(66,52);
$pdf->SetFont('helvetica','B',10);
$pdf->Cell(150,20,'new text written '.date('r'));
$pdf->Ln(5);
$pdf->SetX(66);
$pdf->Cell(150,20,'more text written soon thereafter');
$pdf->Output('./output.pdf','F');
$pdf->closeParsers();
On Fri, 30 Jun 2006, Aaron Fischer wrote:
> Greetings,
>
> I am working with the FPDF and FPDI classes and have run into an issue.
> When I import a pdf to use as a template it comes in smaller than it's
> original size. I have specified the size of the template to be full
> page and set the margins for the pdf page to zero but the issue remains.
>
> Code excerpt:
>
> $pdf->SetMargins(0,0,0);
> $pdf->addPage();
> $pdf->useTemplate($tplidx,0,0,215.9,279.4);
>
> (Unit measurements 215.9 and 279.4 are in mm, equivalent to specifying
> 8.5 x 11 inches.)
>
> Has anyone working with the FPDI class noticed an issue with the
> template size? Workarounds or suggestions?
>
> Thanks,
>
> -Aaron
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> New York PHP Conference and Expo 2006
> http://www.nyphpcon.com
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
---
David Mintz
http://davidmintz.org/
Amendment IV
The right of the people to be secure in their
persons, houses, papers, and effects, against
unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon
probable cause, supported by Oath or affirmation,
and particularly describing the place to be
searched, and the persons or things to be seized.
More information about the talk
mailing list