The following routines are used to add new pages to your document, or set the "current" page, where subsequent text and graphic elements will be placed:
newPage Create a new page
setPage Set the "current" page
About the Master Page
Page 0 of each document is the document's master page. The master page is the default "current" page of a newly created document, or one that has been cleared by a call to reset. Any text or graphic element added to the master page will be drawn on every page of the document, beneath the contents of each individual page. Calling setPage with a value of 0 will set the master page as the current page of the document.
newPage
Syntax: newPage(document)
Returns: the page number of the newly created page
The newPage function adds a page to the PrintOMatic document and makes it the current page. It returns the page number of the newly created page.
NOTE: If you want your document to print, it must have at least one page. A common mistake is inadvertently add a number of elements to the master page — instead of page 1 — of a document by forgetting to call newPage beforehand. The resulting document will not print because it contains no body pages.
setPage
Syntax: setPage document, pageNumber
The setPage command sets the "current" page of the document, where subsequent text and graphic elements added to the document will be placed. If the pageNumber value is greater than the number of pages currently in the document, new pages will be added, and the requested page will still become the "current" page.
Calling setPage with a value of 0 will set the master page to be the current page. Any text or graphic element added to the master page will be drawn on every page of the document, beneath the contents of each individual page.