Printing multiple pages

J. Landman Gay jacque at hyperactivesw.com
Sun Jan 18 22:20:21 EST 2009


Sarah Reichelt wrote:

> OK, found my mistake. I had assumed that "open printing" would queue
> up any print jobs until "close printing". However it only works for
> printing cards, not for for revPrintText or revPrintField. It would be
> good if it did, but since I now realise that it doesn't, I'll work out
> a different method.

Geez, I should have remembered this when you first asked. Both of the 
Rev commands manage the whole print queue themselves, and both contain 
"open printing" and "close printing" commands. I suppose two "open 
printing" commands wouldn't hurt, but Rev's "close printing" will 
trigger before yours does. If your script is only sending one page to it 
at a time, that's all that gets printed.

I know it's more work up front, but I recommend the separate printing 
stack approach, especially since you want to implement a print preview. 
I just finished writing one of those. Having a separate stack made it 
easier because I didn't have to worry about the initial stack size; the 
printing stack was already laid out to accomodate the right paper size. 
For a print preview, I ran my printing script normally, but added a 
parameter to my printing handler that indicated whether this was going 
to a preview or a printer. If printer, the script implemented "open 
printing", etc. If preview, it put a snapshot of the loaded page into a 
variable and sent it back to the calling handler.

I then created (yet another) substack for showing print previews. This 
is the stack that actually calls the printing command in the print 
stack. This one-card preview stack had "next" and "previous" buttons and 
a few other controls. The snapshot the printing handler returned was 
loaded into an empty image object in the preview stack. The image was 
then resized according to the size of the preview window. Sometimes it 
looked fuzzy at certain sizes, but it was adequate. If it doesn't matter 
for you app, I think I'd remove the resizing ability and lock the 
preview to the size of the paper. That way snapshots wouldn't distort, 
they would always be at 100%.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the Use-livecode mailing list