Printing Hell

Chipp Walters chipp at chipp.com
Mon Jan 24 22:04:52 CST 2005


Hi Frank et al,

Other than right-clicking and selecting 'print', there's no way to print 
programatically from altBrowser. Perhaps a good 'feature enhancement!'

BTW, I just finished designing a cross-platform print solution for a 
client. Actually, I found the printing capabilities of Rev to be superb.

Here's my general approach.

1) create a stack for 'print only'
2) set the formatForPrinting of the stack to true
3) If you want to print so that 10pt screen= 10 pt print, then set the 
size of the stack to 8.5*72 pixels Wide X 11.0*72 pixels High (612*792). 
I position this window offscreen so no one ever sees it
4) Make sure you have good margin settings for your flds so that a 
letter won't get 'cut-off' at the end of a line. I set my fld margins to 
8 or 10.
5) You need to create a function to check for overflow text. Use the 
formattedHeight property of a field to help do this.
6) I was able to create a very nice print preview feature where I 
captured the print stack to an img file, then loaded it in a preview 
stack at 50% size. Works great on both platforms. I used Ken Ray's tip 
on capturing the image of a stack from his www.sonsothunder.com site.

Here's part of the code:

open printing
   set the defaultStack to "altPrint"
   repeat with x = 1 to tNumPages
     renderPage x
     print card into 0,0,(8.5*72),(11*72)
     if x <> tNumPages then print break
   end repeat
close printing

renderPage did the work of moving whatever it is I wanted to the page. 
tNumPages is the number of pages I wanted printed. Note the 'print 
break' command to force a new page.

hope this helps,

-Chipp


Frank Leahy wrote:

> I don't know if this would work, but what about printing from Chipp's 
> altBrowser plugin?
> 
> Maybe Chipp can chime in here about whether one can print from altBrowser.


More information about the use-livecode mailing list