Creating Document Objects with new

Syntax: set doc = new(xtra "PrintOMatic") (full version)

or set doc = new(xtra "PrintOMatic_Lite") (lite version)

The new command is used to create a new instance of the PrintOMatic or PrintOMatic Lite MX Xtra. The newly created instance is called a document object, since it represents a printable "document": a collection of items that are printed together in a single print job by the Xtra.

Once your document has been created and stored in a Lingo variable, its settings can be modified, items can be appended to the document, and it can be printed or displayed in a print preview window.

Important Note:

new will return an error code instead of a document object if there is no currently selected printer, or a printing error occurs. Always check the result of new with the objectP() function to make sure you have a valid Xtra instance before continuing!

Example:

The following code example creates a new document, sets the page orientation to landscape mode, appends an image with a caption to the document, and prints the document:

set doc = new(xtra "PrintOMatic") -- or new (xtra "PrintOMatic_Lite")

if not objectP(doc) then exit

append doc, member "picture", TRUE

append doc, RETURN & "Image printed by my sample code.", TRUE

if doJobSetup (doc) = TRUE then print doc

set doc = 0