Print to paper and PDF

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
a-revuser
Posts: 23
Joined: Fri Dec 04, 2009 10:23 am

Print to paper and PDF

Post by a-revuser » Thu Feb 18, 2010 3:39 pm

I have looked at the User manual, Resource Centre, Lessons and the Forum, and find printing poorly explained.
Printing a simple card with a screen ratio shape in landscape can be a bit hit or miss depending if you print to a printer, pdf or the built in pdf of 4.5.0.dp2

--print routine for paper and Adobe PDF writer
answer printer
set the printmargins to 60,30,30,30
set the printpaperorientation to "landscape"
--set the printpaperorientation to "portrait"
set the printcolors to true
set the printcardborders to true
get the printRectangle
set the printscale to 0.7
print this card
-- end of print routine

With the inbuilt pdf it will not recognise landscape at all.

--print routine for built in PDF in version 4.5.0.dp2
ask file "Choose a file for the PDF:"
if it is not empty then
open printing to pdf it
set the printmargins to 60,30,30,30
set the printpaperorientation to "landscape"
--set the printpaperorientation to "portrait"
set the printcolors to true
set the printcardborders to true
get the printRectangle
set the printscale to 0.7
print this card
close printing
launch document it
end if
Now I want to print a series of GROUP objects from several cards. These GROUP objects are a small area of a large area of card (otherwise, I could keep printing full cards).
The way the groups are set out to print on the page is not clear. (there may be 4 groups to an A4 portrait arranged as a neat report)
It might also be desireable to print Bold, Underlined text headings between groups that are not part of the group.

Has anyone got a straightforward solution to this?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Print to paper and PDF

Post by Mark » Fri Feb 19, 2010 9:25 pm

a-revuser,

I'm sorry to address you like that, but I have no clue about your name.

The easiest way to print a composite of objects is by using a template stack. Create a stack and set it's width and height to items 1 and 2 of the printPaperSize property. Position the objects the way you want. Fill fields with data. Make sure that the lockLoc of images is set to true.

You can write a script to add fields to groups. Set the bottomleft of these fields to the topleft of the repsective groups. There is also a showName property for groups, which might be useful.

You might want to use different templates, depending on the printPaperSize.

Now print the card and it will fit perfectly on your paper.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply