Function

CGContextBeginPage

Starts a new page in a page-based graphics context.

Declaration

void CGContextBeginPage(CGContextRef c, const CGRect *mediaBox);

Parameters

c

A page-based graphics context such as a PDF context. If you specify a context that does not support multiple pages, this function does nothing.

mediaBox

A rectangle defining the bounds of the new page, expressed in units of the default user space, or NULL. These bounds supersede any supplied for the media box when you created the context. If you pass NULL, Core Graphics uses the rectangle you supplied for the media box when the graphics context was created.

Discussion

When using a graphics context that supports multiple pages, you should call this function together with CGContextEndPage to delineate the page boundaries in the output. In other words, each page should be bracketed by calls to CGContextBeginPage and CGContextEndPage. Core Graphics ignores all drawing operations performed outside a page boundary in a page-based context.

See Also

Setting Up a Page-Based Graphics Context

CGContextEndPage

Ends the current page in a page-based graphics context.