TCPDF Rotate Whole page by 180 Degree (Upside down/Reverse)

TCPDF is full of power but have terrible parameter and poor documentation.
In case your printer need to print PDF in reverse position.
This article may save you some time reading the source code:

If you are using predefined format, change:

$pdf->AddPage('L', 'A4');


$pdf->AddPage('L', array('format' => 'A4', 'Rotate' => -180));

If you are using custom size, change:

$pdf->AddPage('P', array($document_width, $document_height));


$pdf->AddPage('P', array(0 => $document_width, 1 => $document_height, 'Rotate' => -180));

Test on TCPDF 6.2.11

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.