Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Non-standard page size’s in TCPDF

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.



This post first appeared on David Pratt - JavaScript, JQuery, CSS3, Drupal, SE, please read the originial post: here

Share the post

Non-standard page size’s in TCPDF

×

Subscribe to David Pratt - Javascript, Jquery, Css3, Drupal, Se

Get updates delivered right to your inbox!

Thank you for your subscription

×