Article Preview
Buy Now
FEATURE
Cross-Platform Printing
Printing Styled Text and Graphics
Issue: 7.4 (May/June 2009)
Author: Tom Baumgartner
Author Bio: Tom is retired and enjoys programming in REALbasic, especially during the Canadian winter when he can't golf, fish, or play tennis.
Article Description: No description available.
Article Length (in bytes): 15,747
Starting Page Number: 20
Article Number: 7410
Resource File(s):
7410.zip Updated: 2009-05-01 11:25:22
Related Link(s): None
Excerpt of article text...
Writing your first REALbasic program that prints only from the Mac is both a blessing and a curse. It is a blessing because printing from the Mac works basically as you expect. It is a curse because, when you port the program to Windows, you find that printing is not straightforward. Both text and graphics will be smaller than you expect and spacing will be incorrect. The REALbasic documentation regarding printing of graphics is not as helpful as it should be. This article discusses the issues and presents one method of writing a cross-platform program that prints styled text and graphics.
Our example project is based on a project I created for myself when I wanted to print four-up postcards (the same design four times on a letter-sized page). The program has a main window in which the user will enter their styled text into an EditField and the user can put a picture into a movable imageWell as shown in Figure 1. (The same functionality could be achieved by drawing the user's typed input on a canvas but implementing a text editor in a canvas is extremely complex.) The text and picture are then printed four times in the four quadrants of an 8.5 by 11 inch page (see printout results in Figure 2). Seems simple, but let's start digging into the details.
Resolution
The default resolution is 72 DPI (dots per inch). Modern printers are capable of much higher resolutions for better looking results. REALbasic's
PrinterSetup
class provides properties to set the resolution.
...End of Excerpt. Please purchase the magazine to read the full article.