Print cards with headers

J. Landman Gay jacque at hyperactivesw.com
Thu Apr 22 00:57:16 EDT 2004


On 4/21/04 8:21 PM, Sarah Reichelt wrote:

> I have a stack of about 120 small cards, each displaying a chart (a set 
> of graphic objects, with text labels). I need to print them all out into 
> a report. This works fine, I can print 8 to a page and get a good result 
> BUT I want headers & footers as well (title, date, page number etc).

I think I'd use the form "print card into <rect>". It takes some 
twiddling but it can do almost anything. The basic idea would be:

create a stack to hold your header stuff
create a stack to hold your footer stuff
calculate the print area for the header in pixels
calculate the print area for the footer in pixels
open printing
Start a repeat loop that does this:
  set the defaultstack to the header stack
  print this card into <rect> -- pixel rect at top of page area
  set the defaultstack to the main stack
  repeat 8
   calculate pixel area on page for this graphic
   print this card into <rect> -- the area you just calculated
   go next
  end repeat
  set the defaultstack to the footer stack
  print this card into <rect> -- at bottom of page
end repeat

Each time through the main loop, you can add 1 to the page number field 
in the header or footer and update any other info you need. Since the 
"into rect" form also does scaling automatically, the graphs can be just 
about any size you want and you can fit any number on a page (I used 8, 
since you mentioned that number.) When you have a full page, issue:

print break

which forces a page break and sends that page to a print record. Keep 
looping until all cards are done. Then issue:

close printing

which actually sends the print job to the printer.

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


More information about the use-livecode mailing list