Setting paper size in FPDF

irwan picture irwan · May 3, 2012 · Viewed 105.4k times · Source

i want to seting paper size in fpdf to a half of letter size, it's approximately 8.5x5.5 inc. How can i do that?
My fpdf function in php language is

$pdf = new FPDF('P','mm','?????');

is there any solution? Thank's before for your help..

Answer

kuba picture kuba · May 3, 2012

They say it right there in the documentation for the FPDF constructor:

FPDF([string orientation [, string unit [, mixed size]]])

This is the class constructor. It allows to set up the page size, the orientation and the unit of measure used in all methods (except for font sizes). Parameters ...

size

The size used for pages. It can be either one of the following values (case insensitive):

A3 A4 A5 Letter Legal

or an array containing the width and the height (expressed in the unit given by unit).

They even give an example with custom size:

Example with a custom 100x150 mm page size:

$pdf = new FPDF('P','mm',array(100,150));