26

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..

kuba
  • 7,329
  • 1
  • 36
  • 41
irwan
  • 313
  • 1
  • 4
  • 11

2 Answers2

69

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));
maxhb
  • 8,554
  • 9
  • 29
  • 53
kuba
  • 7,329
  • 1
  • 36
  • 41
  • 4
    To extend this answer, in addition to using the constructor to set the defaults, e.g. $pdf = new FPDF('P', 'mm', 'A4'), the size can also be set specific for each page, e.g. $pdf->AddPage('L', 'A3'); though the units cannot be specified on a per-page basis, so if you specify an array of width and height instead of A4/A3 for the size parameter, while you can change the dimensions for each page, all pages must have it specified in the same unit, one of points (pt), millimetres (mm), centimetres (cm) or inches (in). – richhallstoke Jun 27 '16 at 12:52
-1
/*$mpdf = new mPDF('',    // mode - default ''
 '',    // format - A4, for example, default ''
 0,     // font size - default 0
 '',    // default font family
 15,    // margin_left
 15,    // margin right
 16,     // margin top
 16,    // margin bottom
 9,     // margin header
 9,     // margin footer
 'L');  // L - landscape, P - portrait*/