SimplePdf
MMO\pdf · 1 symbol · generated 27 Oct 2026
SimplePdf
SimplePdf.php:24A new PDF written from code -- an invoice, a receipt, a report: headings, text, labelled fields, a table whose columns fit their content, totals. Built on the bundled FPDF (src/vendor/fpdf) and its core fonts; texts are UTF-8, written in the fonts' own encoding (cp1252: accents, €, œ; a character outside it prints as ?).
- Namespace
MMO\pdf
Index
| font | the font of every text: Helvetica, Times or Courier | |
| lineHeight | the height of a line, in mm | |
| size | the size of body text, in points | |
| encode($text) static | $text in the core fonts' encoding (cp1252) | |
| fields($fields) | Labelled values, one per line: the labels bold, in a column as wide as the longest | |
| fit($text, $width) | $text cut to fit $width mm, with ... | |
| fpdf() | FPDF itself, for what this class does not do (http://www.fpdf.org) -- its texts are cp1252: encode | |
| heading($text, $size) | A title, bold, $size points | |
| measure($titles, $rows) | Each column's width: what its widest text needs, scaled to fill the page | |
| output() | The PDF's bytes | |
| response($filename, $inline) | The PDF as the answer to a request -- what a route or a page returns | |
| save($filename) | Writes the PDF to $filename | |
| space($height) | An empty space, $height mm high | |
| table($headers, $rows, $align, $widths) | A table: a shaded header row, then a row per item. | |
| text($text, $style, $align) | A paragraph, wrapped to the page's width; $style B, I, BI or `` | |
| totals($totals) | Totals under a table, aligned on the right: the label, then its value, the last line bold | |
| __construct($title, $orientation, $format) |
Properties4
font
the font of every text: Helvetica, Times or Courier
- Type
- string
lineHeight
the height of a line, in mm
- Type
- float
- Type
FPDF
size
the size of body text, in points
- Type
- float
Methods14
encode($text)
staticSimplePdf.php:53$text in the core fonts' encoding (cp1252)
fields($fields)
SimplePdf.php:84Labelled values, one per line: the labels bold, in a column as wide as the longest
fit($text, $width)
SimplePdf.php:202$text cut to fit $width mm, with ...
fpdf()
SimplePdf.php:48FPDF itself, for what this class does not do (http://www.fpdf.org) -- its texts are cp1252: encode
| returns | FPDF |
heading($text, $size)
SimplePdf.php:58A title, bold, $size points
measure($titles, $rows)
SimplePdf.php:183Each column's width: what its widest text needs, scaled to fill the page
output()
SimplePdf.php:151The PDF's bytes
| returns | string |
response($filename, $inline)
SimplePdf.php:166The PDF as the answer to a request -- what a route or a page returns
| $filename = 'document.pdf' | string | the name the browser gives the file |
| $inline = true | bool | true: the browser shows it; false: it saves it |
| returns | StreamResponse |
save($filename)
SimplePdf.php:156Writes the PDF to $filename
space($height)
SimplePdf.php:75An empty space, $height mm high
table($headers, $rows, $align, $widths)
SimplePdf.php:108A table: a shaded header row, then a row per item. Each column is as wide as its content needs, the widths scaled to fill the page; a text too long for its column is cut with .... The header row is repeated on every new page.
text($text, $style, $align)
SimplePdf.php:67A paragraph, wrapped to the page's width; $style B, I, BI or ``
totals($totals)
SimplePdf.php:140Totals under a table, aligned on the right: the label, then its value, the last line bold