Open hankivy opened 5 years ago
You can't change page size in the middle of a page, but you can change on a new page (the document is a mixture of page sizes, defaulting to whatever was set in the overall document, which in turn defaults to US Letter). Also, you can call mediabox() with no parameters to be told what the current page dimensions are. I know that works in PDF::Builder; I think it's also implemented in PDF::API2.
The following paper size method is not supported. (See PDF::API2 in CPAN.)
$page->mediabox $alias
Examples: $pdf->mediabox($name) $pdf->mediabox($w, $h) $pdf->mediabox($llx, $lly, $urx, $ury)
All of the above sets the global mediabox, or page size.
More specific examples: $pdf = PDF::API2->new(); $pdf->mediabox('A4'); ... $pdf->saveas('our/new.pdf');
$pdf = PDF::API2->new(); $pdf->mediabox(595, 842); ... $pdf->saveas('our/new.pdf');
$pdf = PDF::API2->new; $pdf->mediabox(0, 0, 595, 842); ...
The supported name values, aliases, are '4A0', '2A0', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', '4B0', '2B0', 'B0', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'LETTER', 'BROADSHEET', 'LEDGER', 'TABLOID', 'LEGAL', 'EXECUTIVE', and '36X36'. It would be nice to add portrait/landscape support.
It is not expected to require changing paper size in the middle of building a PDF file.
Support could be added as additional option values in the command line.