BYU Home pageBRIGHAM YOUNG UNIVERSITY
  Humanities Technology and Research Support Center
Back     CHum Revolution Gateway

CHum 310
Printing in Revolution

As you might expect, Revolution provides ways to output the content of your stack to a printer. Let's look at the Revolution language elements that enable you to control printer output.

Printing Cards—the print Command

The most basic capability is to print a card or cards from your stack, relying on the layout of your cards to determine the layout of the printed page. You could, of course, simply use the Print Card... item from the File menu. But often you want more control over the final appearance of the printed product. The print command gives you the capability to initiate a print card job from any handler. There are several forms of the command:

print card --print the designated card

print card 1

print card from topLeft to rightBottom --print the rectangular area from the designated card

print card 1 from 100,50 to 500,450

print stack -- print all the cards in the designated stack

print stack "myStack"
print all cards
--these two commands are equivalent

print number cards -- print the given number of cards, starting from the current card.

print 20 cards

print marked cards -- print all cards in the stack for which the marked property is true

print card into pageRectangle -- print the card into a rectangle that you define

print card 1 into 72,100,450,400 -- the four values indicate the left, top, right, bottom edges of the printing rectangle, in point from the edge of the paper. (1 inch = 72 points)

print break -- forces a page break

If you specify a form that includes more than one card (such as print stack), the cards may be printed more than one to a page, depending on the size of the cards and on whether you specify a pageRect.

Printing Properties

There are several properties that allow you to control the appearance of the printed product, as follows:

TERM

TYPE

Description

printScale

property

Specifies how much cards are shrunk or expanded when printing. The default value is 1.

The printScale specifies the ratio between the number of pixels in the card and the number of points on the printed page. A ratio of 1 means the printed and screen card should be the same size, if the screen's resolution is 72 pixels per inch.
For example, if a card is 360 pixels wide and you want its printed image to be 4 inches (288 points) across, set the printScale to 0.8 (288 pixels divided by 360 points).

Examples:

set the printScale to 2 -- prints double size
set the printScale to .25 -- prints one quarter size

printMargins

property

Specifies the width of the page margins when printing cards.

The margins are in the order left, top, right, bottom. The default is 72,72,72,72 (72 points = 1 inch)

Examples:

set the printMargins to 72,144,72,72 -- 2" margin on top, 1" on the other sides.

printGutters

property

When more than one card is printed per page, specifies how much blank space is used to separate printed cards on the page.

There are two parameters, for the vertical and horizontal separation. (72 points = 1 inch.)

Examples:

set the printGutters to 18,36 -- 1/4" vertical separation, 1/2" horizontal separation.

printPaperSize

property

Specifies the dimensions of the paper used for printing.

Use the printPaperSize property to control the size of the printout.

The printPaperSize consists of two non-negative integers, separated by a comma.
By default, the printPaperSize is the pixel size set by the print driver. On Mac OS and OS X systems, this is set in the Page Setup dialog box; on Windows systems, it is set in the printing options dialog box.

Example:

set the printPaperSize to 612,792 -- 8.5x11 inches, US Letter size

printRotated

property

Specifies whether Revolution prints in landscape mode or portrait mode. If false, prints in portrait mode; if true, prints in landscape mode.

Default is false.

Example:

set the printRotated to true -- prints in wide "landscape" mode

formatForPrinting

property

***Windows only!***
Specifies whether font layout is done using printer fonts or screen fonts.

Windows systems may use different font versions for printing and for screen display, and the spacing of the print version may differ from the spacing of the screen version. This can result in layouts and line breaks differing between the screen display and the printed result. For the best appearance of printed cards in a stack, make sure the stack is closed (and not in memory), then set the stack's formatForPrinting property to true before opening the stack to print it.

Important! Do not edit field text in a stack whose formatForPrinting is true. Doing so can cause display anomalies. Set the formatForPrinting property to false before you make changes to text in fields.

The spacing of printer font versions usually results in a difficult-to-read display when these fonts are used for screen viewing. To avoid display problems, set the formatForPrinting property to true only when printing. To let the user preview the appearance of the printed output, set the formatForPrinting property to true before opening the stack.

Displaying the Print Dialog

There is a command that lets you display a print dialog before starting the print job:

answer printer - Opens a dialog that lets you set standard printing options like paper size and page orientation, before printing.

On Mac systems answer printer displays the Page Setup dialog that lets you specify paper size and orientation, which correspond to the printPaperSize and the printRotated properties. You can display the standard Print dialog on a Mac OS system using open printing with dialog(see below.)

Printing Text from Fields

In addition to printing entire cards you may also send formatted or unformatted text to the printer by using special commands:

revPrintField field descriptor - Prints the text in the field using the field's text properties.

revPrintText text,header text,footer text,fieldTemplate - Prints any text. Also allows you to set a header and footer. If the text being printed is plain text, and a fieldTemplate is specified, the text is printed with that field's textFont, textSize, and textStyle

revShowPrintDialog showPageSetup,showPrintDialog - Lets you display the standard print dialog for the user before printing The two arguments—showPageSetup and showPrintDialog— should be set to either true or false.

More on Printing Multiple Cards

You can print batches of cards in a single job by using:

open printing [with dialog] -- The with dialog option displays the standard print dialog on Macintosh systems. On Windows and Unix systems, this option is ignored. Instead, use the answer printer command, above.

close printing

Between the open and close statements you can issue one or more print card commands. Cards printed in conjunction with this structure will print to a single page (assuming they are sized to do so.) For example, the following button handler will print all the cards in the stack, four to a page:

  on mouseUp 
	 set the printRotated to true
	 open printing with dialog
	 if the result is "Cancel" then exit mouseUp
	 set the printScale to .4
	 set the printMargins to 36,36,36,36 --1/2 inch margins
	 set the printGutters to 18,18 --1/4 inch gutters
	 repeat with i = 1 to number of cards
	   print card i
	 end repeat 
	 close printing -- sends job to printer
  end mouseUp

You can use a print break command within the open printing structure to force a page break.


Back     CHum Revolution Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University