Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 7.4

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):

Download Icon 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.