Print file

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
neville
Posts: 47
Joined: Tue Apr 15, 2008 8:37 am

Print file

Post by neville » Sun Apr 03, 2016 2:46 pm

I have a card which prints correctly in MacOS using "print cd ..into.." but the formatting goes awry (in fact some bits don't print at all) in Windows. I gather the correct solution is to use "open printing for PDF". Great, it produces a correct PDF file on both platforms. Now how do I print the PDF file? I can "print card" or "print stack" but where is "print file"? This must be a dumb question, because surely every language has a method for printing files; so what I am I missing?

Klaus
Posts: 13865
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Print file

Post by Klaus » Sun Apr 03, 2016 3:05 pm

Hi neville,

you aren't missing anything, LC cannot print external files!
But check the "formatforprinting" property in the dictionary, maybe that helps.


Best

Klaus

neville
Posts: 47
Joined: Tue Apr 15, 2008 8:37 am

Re: Print file

Post by neville » Sun Apr 03, 2016 3:28 pm

B***er! If LC produces PDF it ought to be able to print it.

I was hoping to avoid formatforprinting, it just seems too weird - only works with an invisible stack which has to be closed purged and then re-opened, don't edit ... that surely must have been a temporary kludge for which I guessed "open printing for PDF" was to be the proper elegant solution.

I wonder if I could use a doshell command, streaming .. no, there be demons (daemons?)

neville
Posts: 47
Joined: Tue Apr 15, 2008 8:37 am

Re: Print file

Post by neville » Mon Apr 04, 2016 10:32 am

I have formatForPrinting working, with some minor problems of measureText not giving quite accurate results and clear backgrounds being rendered in grey, both surmountable problems. Printing to PDF would be a much less cumbersome (and generic) solution however so I will be making a feature request for printing pdf files.

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Print file

Post by MaxV » Thu Apr 14, 2016 1:47 pm

To print on Windows, substituting <printer name> and <nameFile> with the correct ones:

Code: Select all

put shell("cscript prnjobs.vbs –l –p <printer name>  <nameFile>")
to print on Linux or Mac:

Code: Select all

put shell("print  <nameFile>")
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

neville
Posts: 47
Joined: Tue Apr 15, 2008 8:37 am

Re: Print file

Post by neville » Fri Apr 15, 2016 2:03 am

Good one! Definitely a code snippet to squirrel away in a macro.

The LC team has noted the feature request, evidently not such a hard thing to implement, at least on MacWinLin.

Thank you.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”