Getting and setting printer settings without dialogs?

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
Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Getting and setting printer settings without dialogs?

Post by Garrett » Tue Sep 30, 2008 11:58 pm

Ok, now you all have opened a can of worms for me here.. Whoooooole new world opened up for me! :-)

I'm starting to catch on to the printing stuff, like making sure you adjust your printable area to compensate for the margin sizes set for the print job.

But! Now I'm trying to find out how to find out what the margin sizes are set for the printer, and how to set them from my own code without user intervention prior to printing.

I found the "printerSettings" property, is that what I'll be using? If so, is anyone willing to give me some more details on this property than what the docs in 2.9 are giving me?

Thanks in advance,
~Garrett

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

Post by Janschenkel » Wed Oct 01, 2008 6:11 am

Hi Garrett,

The 'printerSettings' property is a raw environment-dependent binary string: it describes the settings of the user-selected printer on a single computer in a way that you can't parse, just 'get' and 'set'. So that's useful for those situations where you want to ask the user for his settings once and save that somewhere to restore it every time your application starts.

You're looking for the 'printerFeatures', 'printMargins', 'printPaperScale', 'printRotated' and similar global properties. The easiest way is to open the Rev dictionary, choose 'All' in the left-hand list and then type 'print' into the search filter field.

Also, you can find a few examples in the Revolution Resource Center inside the IDE: in the left-hand list, fold out the 'Sample Scripts' entry: it should contain 3 examples for printing.

Last but not least, the User Guide contains a comprehensive chapter on Revolution's printing features - see chapter 9, starting on page 286.

Hope this gets you started - printing in Revolution is not that complicated and in fact very flexible but it takes some getting used to the finer points, such as 'formatForPrinting' on Windows.

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

Garrett
Posts: 386
Joined: Sat Apr 08, 2006 8:15 am
Contact:

Post by Garrett » Wed Oct 01, 2008 9:41 am

Sweet, thanks for the info.

I did type "print" in the search box, but didn't see the printMargin one.. maybe my old eyes just over looked it.

Thanks again,
~Garrett

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Oct 01, 2008 10:34 am

If you're using 2.9 there's quite a good video tutorial on Layout Printing which should help you grasp some of the concepts, as well as the user guide.

If you open the documentation with the toolbar icon (ie, not the user guide) and pick the "getting started" flag, then the "in depth" box on the bottom right, you will be able to pick from various tutorials. Layout printing is the last one on the list. Hope that helps.

(Aside: Rev 3.0 has some nice tutorial material too, but I can't find how to get to view some of these "older" tutorials - the layout printing one for example is very useful, so why can't I find it in v. 3.0?)

Post Reply