printing cards

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
Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

printing cards

Post by Glenn Boyce » Tue Jun 22, 2010 7:50 am

I seem to be having a lot of trouble printing a card. when I print manually from a stack (when I'm in the application builder) only part of the card is printed on an A4 page. I've tried setting up buttons to print using the print into command and it doesn't make any difference. At this stage if I want to print a complete card I have to take a screen shot and paste it into Word! size of the card is 1008,700 pixels.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: printing cards

Post by dunbarx » Tue Jun 22, 2010 2:28 pm

Is the card larger than the A4 page? In other words, when you say "only part of the card is printed..." do you mean that most of the A4 page itself is blank, or is the page fully filled up, but with only part of the card?

Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Re: printing cards

Post by Glenn Boyce » Tue Jun 22, 2010 11:20 pm

The card is 1008 by 700 pixels which fits comfortably on a laptop screen. even when I reduce the size in the printer dialogue I still get the same image (part of the card) but smaller!

cheers

Glenn

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: printing cards

Post by Janschenkel » Wed Jun 23, 2010 6:18 am

By default, printing doesn't scale the card to fit your paper size and/or print margins. So you're going to have to do some scripting. Off the top of my head:

Code: Select all

on mouseUp
   local tTargetRectangle, tTargetWidth, tTargetHeight, tSourceWidth, tSourceHeight
   local tBestFitScale, tPrintMargins
   --
   answer page setup
   if the result is "Cancel" then exit mouseUp
   -- determine the available width and height on the page
   put the printRectangle into tTargetRectangle
   put item 3 of tTargetRectangle - item 1 of tTargetRectangle into tTargetWidth
   put item 4 of tTargetRectangle - item 2 of tTargetRectangle into tTargetHeight
   put the width of this stack into tSourceWidth
   put the height of this stack into tSourceHeight
   -- determine the print scale and set it before printing
   put min(tTargetWidth / tSourceWidth, tTargetHeight / tSourceHeight) into tBestFitScale
   put min(1, tBestFitScale) into tBestFitScale
   set the printScale to tBestFitScale
   -- finally set the printMargins to fit the available print area
   put item 1 of tTargetRectangle, \
          item 2 of tTargetRectangle, \
          item 1 of tTargetRectangle, \
          item 2 of tTargetRectangle \
          into tPrintMargins
   set the printMargins to tPrintMargins
   -- go ahead and print
   open printing with dialog
   if the result is "Cancel" then exit mouseUp
   print this card
   close printing
end mouseUp
This will use the most of the printable paper area, scaling to keep the aspect ratio (without blowing it up). If you're running on Windows, printing may not look so good - best to read up on printing in the User Guide pdf file.

HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Glenn Boyce
Posts: 137
Joined: Thu Jul 24, 2008 11:22 pm

Re: printing cards

Post by Glenn Boyce » Mon Jun 28, 2010 2:04 am

Thanks Jan. Have read up the PDF also.

Post Reply