Page 1 of 1

Problem with formatForPrinting not working

Posted: Wed Feb 19, 2020 4:30 pm
by friccio
Hello All,

I'm new to LiveCode, started using it a couple of weeks ago, I made an app that prints tickets using a thermal printer and all was working perfect while working on my Mac, but when I used it in a windows computer I noticed that all the fields printed different, I found that formatForPrinting should be set to true in order for the stack to use the fonts that windows will use when printing, but so far nothing I tried with it has made any difference. As a temporary solution I am printing to a PDF and the executing a shell command to print that PDF, but I would like to be able to do it the right way. Has anybody used formatForPrinting successfully?. Can you tell me or show me the right way to do it? Any help will be very much appreciated.

Thanks

Re: Problem with formatForPrinting not working

Posted: Thu Feb 20, 2020 6:53 pm
by jacque
Welcome to LiveCode! Can you describe how the printout differs on Windows? Also, post the relevant portion of the printing handler.

If the only issue is incorrect line wraps it is probably because Windows fonts have different widths than Mac fonts. You can fix that by changing the font size (or the font itself) when printing on a Windows machine. Your script can find out what OS is running by checking "the platform".

Re: Problem with formatForPrinting not working

Posted: Thu Feb 20, 2020 9:39 pm
by SparkOut
I don't often print from LiveCode but when I do it is on Windows and setting a "print stack" to have formatForPrinting as true, it "works". This setting also applies when printing to pdf so I am not sure whst is "wrong" with how you are trying to print. As jacque says, could you provide some sample code?