Re: How to center image in PDF (fpdf) using Image() in PHP....
| From: | Evan Nemerson | Date: | Sat, 04 Oct 2003 00:37:16 +0000 |
| Subject: | Re: How to center image in PDF (fpdf) using Image() in PHP.... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165008@lists.php.net to get a copy of this message | ||
A4 is a paper size. IIRC the standard pretty much everywhere but the US.
Now, it's been a while since I used FPDF, but taking a quick look at pdfp.php,
here are some properties that stand out:
var $fw,$fh; //dimensions of page format in user unit
var $lMargin; //left margin
var $rMargin; //right margin
Those are from version 1.51. Unfortunately, they are commented as 'private',
so they may have changed, or actually marked private for PHP5. If so, they're
easy to find- very beginning of fpdf.php.
My biggest problem w/ FPDF is that the documented API is not nearly powerful
enough. Luckily, you can do a lot of cool stuff using undocumented features,
but that means going through a rather large class (although it is IMHO
well-coded, which helps). It would be rather easy to extend the API to
encompass these useful features. Hope Oliver heard that.
Anyways, using those properties, plus the width of your image, you should be
able to center it easily enough in a way much more portable to other page
sizes than you currently have.
On Friday 03 October 2003 02:48 pm, Scott Fletcher wrote:
> I don't know what is A4 page. Problem is I don't use PDF very, very often
> so I'm a newbie on PDF....
>
> "Marek Kilimajer" <kilimajer@webglobe.sk> wrote in message
> news:3F7DED69.5030103@webglobe.sk...
>
> > Scott Fletcher wrote:
> > > I would never guess about the ruler to measure the width because it
>
> wouldn't
>
> > > work that way. Why? Because the PDF page can be in any size when I
>
> either
>
> > > maximize the Acrobat Reader or use the mouse cursor to make it wider or
> > > narrower. This does not help me to measure the actual width of the PDF
>
> so
>
> > > that's why the thought of the ruler never came to my mind....
> >
> > That is the size on the screen, but this has nothing to do with the size
> > pdf is printed. PDFs are designed for printing and have real world
> > measures, not pixels. 210 in the code you have found is width of A4 page.