ps_arcn
ps_begin_pattern
PS Functions
PHP Manual

# ps_begin_page

(PECL ps:1.1.0-1.3.5)

ps_begin_page — Start a new page

### Description

bool ps_begin_page ( resource `$psdoc` , float `$width` , float `$height` )

Starts a new page. Although the parameters `width` and `height` imply a different page size for each page, this is not possible in PostScript. The first call of ps_begin_page() will set the page size for the whole document. Consecutive calls will have no effect, except for creating a new page. The situation is different if you intent to convert the PostScript document into PDF. This function places pdfmarks into the document which can set the size for each page indiviually. The resulting PDF document will have different page sizes.

Though PostScript does not know different page sizes, pslib places a bounding box for each page into the document. This size is evaluated by some PostScript viewers and will have precedence over the BoundingBox in the Header of the document. This can lead to unexpected results when you set a BoundingBox whose lower left corner is not (0, 0), because the bounding box of the page will always have a lower left corner (0, 0) and overwrites the global setting.

Each page is encapsulated into save/restore. This means, that most of the settings made on one page will not be retained on the next page.

If there is up to the first call of ps_begin_page() no call of ps_findfont(), then the header of the PostScript document will be output and the bounding box will be set to the size of the first page. The lower left corner of the bounding box is set to (0, 0). If ps_findfont() was called before, then the header has been output already, and the document will not have a valid bounding box. In order to prevent this, one should call ps_set_info() to set the info field BoundingBox and possibly Orientation before any ps_findfont() or ps_begin_page() calls.

> Note: Up to version 0.2.6 of pslib, this function will always overwrite the BoundingBox and Orientation, if it has been set before with ps_set_info() and ps_findfont() has not been called before.

### Parameters

`psdoc`

  Resource identifier of the postscript file as returned by ps_new().

`width`

  The width of the page in pixel, e.g. 596 for A4 format.

`height`

  The height of the page in pixel, e.g. 842 for A4 format.

### Return Values

Returns `TRUE` on success or `FALSE` on failure.

### See Also

- ps_end_page()
- ps_findfont()
- ps_set_info()

ps_arcn
ps_begin_pattern
PS Functions
PHP Manual