Multi-Page Printing Strategy?

J. Landman Gay jacque at hyperactivesw.com
Mon Aug 30 21:15:08 EDT 2010


On 8/28/10 11:25 PM, Scott Rossi wrote:

> I can write a routine to to tell the app to automatically create each slide,
> but I don't know if I should try to print directly from the main display
> stack, or copy card elements out to an offscreen stack and print from there.
> The display stack can fit standard paper size, so there's no
> resizing/reformatting issue to deal with there.
>
> Could this be as straightforward as the following?
>
> open printing
> <generate slide 1>
> print this cd
> <generate slide 2>
> print this cd
> ...etc.
> close printing

If it fits on the printed page and you don't need to add or remove any 
elements from the printout, then I don't see why you'd need to duplicate 
everything to a printing stack. There wouldn't be any difference. I 
haven't had any technical issues when printing from the original cards. 
I do create printing templates when I need to use a layout that is 
different from the card layout, but if the two are the same there's no 
real reason to. It should be as easy as what you wrote above.

>
> Also, what is the proper method for centering content on a printed page?  I
> see Rev provides printRectangle and printPaperRectangle properties, but I
> can't tell from their descriptions what I would use to center stack content
> within the live area of a printed page.

Unless you need something more elaborate like scaling, I'd think you 
would only need to calculate the correct printmargins. Get the width and 
height of the stack. For each dimension subtract the stack pixel count 
from the page pixel count, divide by two, and that's your margin. You 
can adjust those numbers if you want a bigger margin at the top or the left.

Then you need to account for the printer's default margins. The 
printRectangle gives you the actual rectangle that the printer can print 
to. Most printers have default margins, past which they can't print 
(often, for example, a quarter inch on the sides where the printer just 
can't lay any ink.) You usually need to take this into consideration; if 
you want a half-inch total left margin then you need to account for the 
quarter inch where the printer can't reach, which leaves you another 
quarter inch for your stack's print margin. When you set the leftmargin 
property to a quarter inch, the stack will actually print with a half 
inch margin because the printer's margin is added to the stack's margin. 
Calculate that for all four sides. Each printer is a little different.

The printPaperRect is the dimensions (in pixels) of the printer paper 
itself. If you are printing to a non-standard sized paper then sometimes 
you'll want to consider those dimensions too, but since you say the 
stack will fit on standard paper size I don't think you need to mess 
with that -- unless you want to check whether the printer is set up to 
print envelopes, for example, in which case your stack printout won't fit.

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



More information about the use-livecode mailing list