Non-standard page size’s in TCPDF
By David Pratt / Tags: php, tcpdf / 9 Comments / Published: 23-06-10
If you need to create a PDF using TCPDF that isn’t a standard size (A4, A5, B1, LETTER etc.) then it is possible to specify a custom size even though it isn’t that well documented. To do this you need to pass an array containing the desired width and the height of the PDF instead a formatted parameter such as ‘A4′. For example:
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// add a page
$resolution= array(100, 100);
$pdf->AddPage('P', $resolution);
Make sure you express the height and width in the unit of measurement (pt, px, mm, cm etc.) that you are using as well.
Subscribe via RSS
Twitter
David Pratt June 27th, 2010 at 8:17 pm
Yep, a list of standard page formats can be found here: getPageSizeFromFormat()