Routing Formats
protoPrintFormat
. This proto defines a printNextPageScript
method. By default, printNextPageScript
only handles one page, but you can add code to support multiple pages.
Create any children you wish to have on the printed page. The protoPrintFormat
view will be sized so it is the size of the printable area on the page (the page size inset by the margins). You can then use parent-relative justification with child views to place them in appropriate places on the page. For instance, you might want a footer at the bottom-right of each page. This could be done with a protoStaticText
.
Make sure you consider different paper sizes when designing the layout of your printed page--different printers can and will have different paper sizes. Don't just blindly use top-left justification and assume you know the size of the printed page. Instead, use justification to account for different paper sizes just as you do to account for different screen sizes (see "Justification" on page 121).
The printNextPageScript
message will be sent to your protoPrintFormat
at the end of each page. If there are no more pages, it should return nil
. If there are more pages, it should prepare for the next page and return true
:
printNextPageScript : func() begin if moreToPrint then begin // send messages to children to update // create new children possibly // remove children possibly end else return nil; end
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996