-1

I'm trying to change the page size in my script utilizing TCPDF on form submit. The value submitted is one of the following 'A4' or 'Letter'. I check and see the value posted successfully, however, when the document is generated it is always the same size, 'Letter' I believe. In my script I tried to change it in several ways:

if ($_POST['paper'] == 'A4') {
    define ('PDF_PAGE_FORMAT', 'A4');
} else {
    define ('PDF_PAGE_FORMAT', 'Letter');
}

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

or

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, ($_POST['paper'] == 'A4' ? 'A4 : 'Letter'), true, 'UTF-8', false);

or

$pdf->AddPage("P", $_POST['paper']);

but to no avail. What am I missing?

santa
  • 12,234
  • 49
  • 155
  • 255

1 Answers1

0

I believe based from the static value from this TCPDF repository file the correct format is LETTER (in uppercase) instead of Letter.

Hasta Dhana
  • 4,699
  • 7
  • 17
  • 26