background image
C H A P T E R 2 1
Routing Interface
Using Routing
21-19
in portrait mode (
'portrait
) or horizontally in landscape mode (
'landscape
).
The default value of the
orientation
slot is
'portrait
. Your format should
always use relative view justification and/or check the actual bounds of the print
format by using the
LocalBox
view method. Note that you cannot change the
orientation between a series of pages being printed by a single print format.
If multiple items are being routed (as from a multiple selection in an overview), you
may want to print each item on a separate page or print the items one after another,
placing multiple items on the same page before starting a new page. You can control
this feature by setting the
usesCursors
slot. The default setting of this slot is
nil
.
If you want to lay out multiple items on a page, set the
usesCursors
slot of the
format to
true
. In this case, the target object encapsulates all the items being
routed in a single multiple-item object created by
CreateTargetCursor
. Your
format should call the
GetTargetCursor
method to return a cursor for this
object, on which you can iterate over the individual items to be routed using the
cursor methods
Entry
,
Next
, and
Prev
. If your format can use other print
formats, you can use the
GetCursorFormat
method of the
protoPrintFormat
to find formats for the individual items.
If you want to lay out each item on a separate page, or if this format cannot handle
a multiple-item target object, set the
usesCursors
slot to
nil
. In this case, this
format is invoked multiple times, once for each item being routed, and each item
begins on a separate page.
Printing and Faxing
21
When an item in the Out Box is actually printed or faxed using your print format,
the view represented by the print format is instantiated and drawn to the output
device. As when any view is instantiated, the system sends the print format view
standard messages and also routing-specific messages. For optimal printing
performance, and to avoid timing out a fax connection, you need to be aware of the
sequence of events and know which operations are time-critical.
Here is the sequence of events during a printing or faxing operation:
1. The transport sends the print format the
FormatInitScript
message, to give
you an opportunity to perform initialization operations. You must perform any
lengthy initialization operations in this method, before the transport connection
is made. You can store initialized data in
self
. For more information about
using
FormatInitScript
, see Newton Programmer's Reference.
2. For sending a fax only, the transport sends the print format the
CountPages
message. If you can determine the number of pages in the fax ahead of time, you
should override this method in your print format and have it return the number
of pages (not including the cover page). If you don't override this message, the
transport opens the print format view in an offscreen window and performs steps
3, 4, and 6, below, to go through each page so it can count the number of pages.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна