<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Start a new page</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ps-arcn.html">ps_arcn</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ps-begin-pattern.html">ps_begin_pattern</a></div> <div class="up"><a href="ref.ps.html">PS Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.ps-begin-page" class="refentry"> <div class="refnamediv"> <h1 class="refname">ps_begin_page</h1> <p class="verinfo">(PECL ps >= 1.1.0)</p><p class="refpurpose"><span class="refname">ps_begin_page</span> — <span class="dc-title">Start a new page</span></p> </div> <div class="refsect1 description" id="refsect1-function.ps-begin-page-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>ps_begin_page</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$psdoc</code></span> , <span class="methodparam"><span class="type">float</span> <code class="parameter">$width</code></span> , <span class="methodparam"><span class="type">float</span> <code class="parameter">$height</code></span> )</div> <p class="para rdfs-comment"> Starts a new page. Although the parameters <em><code class="parameter">width</code></em> and <em><code class="parameter">height</code></em> imply a different page size for each page, this is not possible in PostScript. The first call of <span class="function"><strong>ps_begin_page()</strong></span> 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. </p> <p class="para"> 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. </p> <p class="para"> 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. </p> <p class="para"> If there is up to the first call of <span class="function"><strong>ps_begin_page()</strong></span> no call of <span class="function"><a href="function.ps-findfont.html" class="function">ps_findfont()</a></span>, 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 <span class="function"><a href="function.ps-findfont.html" class="function">ps_findfont()</a></span> 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 <span class="function"><a href="function.ps-set-info.html" class="function">ps_set_info()</a></span> to set the info field <em>BoundingBox</em> and possibly <em>Orientation</em> before any <span class="function"><a href="function.ps-findfont.html" class="function">ps_findfont()</a></span> or <span class="function"><strong>ps_begin_page()</strong></span> calls. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> Up to version 0.2.6 of pslib, this function will always overwrite the BoundingBox and Orientation, if it has been set before with <span class="function"><a href="function.ps-set-info.html" class="function">ps_set_info()</a></span> and <span class="function"><a href="function.ps-findfont.html" class="function">ps_findfont()</a></span> has not been called before. </p> </p></blockquote> </div> <div class="refsect1 parameters" id="refsect1-function.ps-begin-page-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">psdoc</code></em></span> <dd> <p class="para"> Resource identifier of the postscript file as returned by <span class="function"><a href="function.ps-new.html" class="function">ps_new()</a></span>. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">width</code></em></span> <dd> <p class="para"> The width of the page in pixel, e.g. 596 for A4 format. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">height</code></em></span> <dd> <p class="para"> The height of the page in pixel, e.g. 842 for A4 format. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.ps-begin-page-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 seealso" id="refsect1-function.ps-begin-page-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.ps-end-page.html" class="function" rel="rdfs-seeAlso">ps_end_page()</a> - End a page</span></li> <li class="member"> <span class="function"><a href="function.ps-findfont.html" class="function" rel="rdfs-seeAlso">ps_findfont()</a> - Loads a font</span></li> <li class="member"> <span class="function"><a href="function.ps-set-info.html" class="function" rel="rdfs-seeAlso">ps_set_info()</a> - Sets information fields of document</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ps-arcn.html">ps_arcn</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ps-begin-pattern.html">ps_begin_pattern</a></div> <div class="up"><a href="ref.ps.html">PS Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>