Name

new_page -- create a new page

Synopsis

int new_page ( [string size] )

Description

This function creates a new page of the size specified by size (or the default page size if no size is specified) and returns a page id that must be used to paint to the page.

size can be one of the following keywords: letter, legal, executive, tabloid, a3, a4, or a5. Or size can be specified by dimensions in the format widthxheight[in|cm]

Pages will appear in the PDF file in the sequence they are created but can be reordered with move_page_before() and swap_pages().

Examples

This is a valid script for creating a single paged PDF file:

$pdf = new pdffile;
$page = $pdf->new_page("letter");
$pdf->draw_text(50, 50, "This is a single page", $page);
echo $pdf->generate();

The following creates a page 5 inches by 3 inches:

$page = $pdf->new_page("5x3in");

The following creates a page using metric sizes:

$page = $pdf->new_page("15x10cm");

See Also

History

The size parameter became optional with version 2.

Bugs

None known