preparing a stack for printing

J. Landman Gay jacque at hyperactivesw.com
Mon Jun 10 15:51:39 EDT 2013


On 6/10/13 10:24 AM, Björnke von Gierke wrote:
> Hi
>
> I'm trying to print a kind of report, and am weirded out by all the
> different rectangles and widths that are available (printRectangle,
> printPaperRectangle, printPaperSize, printMargins, etc.)
>
> All I want is the printable area, so I can set the width and height
> of my stack to that amount, then print the first card.
>
> It seems that the below lines produce an approximation amount, but
> it's not completely correct. The approach also so weirdly backwards
> and roundabout! I guess my question is, isn't there any way to get
> the same or a better result more easily?
>
> put item 3 of the printRectangle -  item 1 of the PrintRectangle -
> item 1 of the printMargins - item 3 of the printMargins into
> myEffectivePrintWidth
>
> put item 4 of the printRectangle -  item 2 of the PrintRectangle -
> item 2 of the printMargins - item 4 of the printMargins into
> myEffectivePrintHeight

All printers include areas of the paper that they can't print on. 
Usually that's about a quarter inch on the sides and a half inch at the 
bottom and sometimes the top, but each printer is different. The 
printRectangle gives you the actual area that the printer is capable of 
printing to.

The printMargins add extra space to that area, so you don't want any 
printMargins. Set all the printMargins to zero.

Method One:

If the card objects are not exactly at the edges of the card, then the 
card's blank space will also be added to the printout. If you want 
objects to appear exactly within the printer's available area, place 
card objects at the very edges and top of the card. Usually that means 
you need to make a separate stack just for printing because in the real 
stack it looks bad.

After all that is done, you can just print directly using the 
printRectangle to determine the size the card should be:

    set the rect of this stack to the printRectangle

Set the printing stack's visibility to false so that the user can't see 
it move to the top left of the screen. You'll probably want to rearrange 
the objects at the edges of the newly sized card before printing.

Method Two:

Alternately you can print the card "into rect" and use the 
printRectangle as the target rect. This won't require a separate 
printing card. That is easier but this method will resize the card 
objects, which may or may not be what you want:

    print this cd from the topLeft of firstObject to the bottomRight of 
lastObject into rect the printRectangle


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





More information about the use-livecode mailing list