phpfpdf

How do I get the width and height of a doc generated with FPDF


How can I get height and width of a document in FPDF.

For example, I've next line:

$this->Cell(200,5,'ATHLETIC DE COLOMBIA S.A.',1,1,'C',1);

But, I want to do something like:

// $x = width of page
$this->Cell($x,5,'ATHLETIC DE COLOMBIA S.A.',1,1,'C',1);

Solution

  • note: read Ross' McLellan's answer below

    As far as I remember you can't do it with vanilla FPDF. You can either extend it to have a method that would return this value for you, or just store the width as a public property of fpdf object.