blob: c79165e884d88b0940e5369dd109b0e372771416 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>__construct</title>
6<link type="text/css" rel="stylesheet" href="../fpdf.css">
7</head>
8<body>
9<h1>__construct</h1>
10<code>__construct([<b>string</b> orientation [, <b>string</b> unit [, <b>mixed</b> size]]])</code>
11<h2>Description</h2>
12This is the class constructor. It allows to set up the page size, the orientation and the
13unit of measure used in all methods (except for font sizes).
14<h2>Parameters</h2>
15<dl class="param">
16<dt><code>orientation</code></dt>
17<dd>
18Default page orientation. Possible values are (case insensitive):
19<ul>
20<li><code>P</code> or <code>Portrait</code></li>
21<li><code>L</code> or <code>Landscape</code></li>
22</ul>
23Default value is <code>P</code>.
24</dd>
25<dt><code>unit</code></dt>
26<dd>
27User unit. Possible values are:
28<ul>
29<li><code>pt</code>: point</li>
30<li><code>mm</code>: millimeter</li>
31<li><code>cm</code>: centimeter</li>
32<li><code>in</code>: inch</li>
33</ul>
34A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This
35is a very common unit in typography; font sizes are expressed in that unit.
36<br>
37<br>
38Default value is <code>mm</code>.
39</dd>
40<dt><code>size</code></dt>
41<dd>
42The size used for pages. It can be either one of the following values (case insensitive):
43<ul>
44<li><code>A3</code></li>
45<li><code>A4</code></li>
46<li><code>A5</code></li>
47<li><code>Letter</code></li>
48<li><code>Legal</code></li>
49</ul>
50or an array containing the width and the height (expressed in the unit given by <code>unit</code>).<br>
51<br>
52Default value is <code>A4</code>.
53</dd>
54</dl>
55<h2>Example</h2>
56Document with a custom 100x150 mm page size:
57<div class="doc-source">
58<pre><code>$pdf = new FPDF('P', 'mm', array(100,150));</code></pre>
59</div>
60<hr style="margin-top:1.5em">
61<div style="text-align:center"><a href="index.htm">Index</a></div>
62</body>
63</html>