The following commands are used get and set the attributes of a PrintOMatic document:
setDocumentName Sets the name of the document
setLandscapeMode Sets landscape or portrait orientation
getLandscapeMode Returns the landscape mode of the document
setMargins Sets the margins of the document
getMargins Returns the margin settings of the document
setPrintableMargins Sets the document margins to the maximum area the printer can print
getPageWidth Returns the width between left and right margins
getPageHeight Returns the height between the top and bottom margins
getPaperWidth Returns the width of the physical paper
getPaperHeight Returns the height of the physical paper
Routines that alter the size or orientation of a document, such as setLandscapeMode, setMargins, and setPrintableMargins, can only be called when your document is empty.
setDocumentName
Syntax: setDocumentName document, name
This command sets the name of a PrintOMatic document, which is displayed in the print progress dialog as the document prints. If background printing is enabled, this document name is also displayed by PrintMonitor (Mac) or Print Manager (Windows) as your document prints in the background.
setLandscapeMode
Syntax: setLandscapeMode document, trueOrFalse
This command switches the page orientation of a PrintOMatic document between landscape and portrait orientation. Since this method changes the whole coordinate system of the document, your document must be empty when you call setLandscapeMode. You can call reset on your document beforehand just to make sure.
In Windows, this method works in a very straightforward manner: call it, and the landscape mode changes.
Unfortunately, it's an entirely different story on the Macintosh. The only safe way to change the page orientation on the Mac is by showing the Page Setup dialog and letting the user manually select landscape mode. While showing a Page Setup dialog may be fine for normal software applications such as Word, it's often unacceptable in the context of a multimedia production.
To get around this, PrintOMatic for the Macintosh relies on a "printer database" to store default landscape and portrait page setups for the most common Macintosh printers. This printer database consists of a set of 'PHDL' resources located in the same file as the PrintOMatic Xtra. This database is used by the setLandscapeMode method in the Macintosh version of PrintOMatic.
If the currently selected printer is not found in the printer database, the user is asked to MANUALLY create default Page Setups for landscape and portrait modes, and those settings are saved and added to the database. This is done through a series of prompt dialogs presented automatically by PrintOMatic when you call setLandscapeMode for an unknown printer.
These user-configured "custom entries" to the printer database are stored in a file called "PrintOMatic Preferences" in the Preferences folder on the user's hard disk. Subsequent calls to setLandscapeMode on the same computer, with the same printer selected, won't present any annoying dialogs.
What the presence of this "printer database" means is that when you change the landscape mode on the Macintosh, all the other Page Setup settings such as scaling, font substitution, etc., will also revert to those found in the printer database. This is important if the user has changed any of these settings (during a call to doPageSetup) before setLandscapeMode is called.
getLandscapeMode
Syntax: getLandscapeMode(document)
Returns: TRUE if the document has a landscape orientation, otherwise FALSE
This command retrieves the page orientation of a PrintOMatic document. getLandscapeMode returns TRUE if the document has a landscape (horizontal) orientation.
setMargins
Syntax: setMargins document, marginRect
This command sets the margins of a PrintOMatic document. The marginRect parameter is in the form of a Lingo Rect. Values are specified in the format Rect(left, top, right, bottom). The measurements are in points (72 points to the inch). Since this method changes the whole coordinate system of the document, your document must be empty when you call setMargins. Call reset on your document beforehand just to make sure.
Example:
The following example creates a new document and sets the margins to two inches (144 points) on the left, and one inch (72 points) on all other sides.
set doc = new(xtra "PrintOMatic")
if not objectP(doc) then exit
setMargins doc, Rect(144,72,72,72)
getMargins
Syntax: getMargins(document)
Returns: the document margins, in Lingo Rect format
This command retrieves the margins of a PrintOMatic document. The return value is a Lingo Rect, but the Rect itself is not a valid rectangle; rather, the top, left, bottom, and right values of the Rect are used to return the margin width on each of those sides. The margin measurements are in points (72 points to the inch).
setPrintableMargins
Syntax: setPrintableMargins document
This command sets the margins of a PrintOMatic document equal to the maximum printable area supported by the current print settings. Since this command changes the whole coordinate system of the document, your document must be empty when you call setMargins. Call reset on your document beforehand just to make sure. After calling setPrintableMargins, you can use the getMargins routine to check the results.
getPageWidth
Syntax: getPageWidth(document)
Returns: the distance between the left and right margins, in points
This function returns the width of a document's "live area", the distance between the left and right margins of the document.
Example:
It is often convenient to retrieve the dimensions of the live area of a document and store them in Lingo variables for use in subsequent calculations. The following example creates two linked frames on the page, for formatting printed output into two columns.
-- create two new frames on the page
-- with 1/2 inch (36 points) in between
set w = getPageWidth(doc)
set h = getPageHeight(doc)
newFrame doc, Rect(0,0,(w/2)-18,h), TRUE
newFrame doc, Rect(0,0,(w/2)+18,h), TRUE
getPageHeight
Syntax: getPageHeight(document)
Returns: the distance between the top and bottom margins, in points
This function returns the height of a document's "live area", the distance between the top and bottom margins of the document.
Example:
It is often convenient to retrieve the dimensions of the live area of a document and store them in Lingo variables for use in subsequent calculations. The following example creates two linked frames on the page, for formatting printed output into two columns.
-- create two new frames on the page
-- with 1/2 inch (36 points) in between
set w = getPageWidth(doc)
set h = getPageHeight(doc)
newFrame doc, Rect(0,0,(w/2)-18,h), TRUE
newFrame doc, Rect(0,0,(w/2)+18,h), TRUE
getPaperWidth
Syntax: getPaperWidth(document)
Returns: the width of the physical paper, in points
This function returns the width of the physical piece of paper that the current document is configured to print on.
getPaperHeight
Syntax: getPaperHeight(document)
Returns: the height of the physical paper, in points
This function returns the height of the physical piece of paper that the current document is configured to print on.