Unable to Print on Linux Mint

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

DaveI
Posts: 8
Joined: Sat Mar 14, 2020 9:55 pm

Re: Unable to Print on Linux Mint

Post by DaveI » Tue Mar 17, 2020 10:23 am

Hello gentlemen,

Last night I cracked it with a good work round. See below.

on Mouseup
local tPrinter, tPath, tShell

-- first create the pdf in /tmp
put "/tmp/Livecode/tempfile" into tPath

open printing to pdf tPath
print this card
close printing

-- Now use os Print selector window to choose a printer and print the pdf

answer printer
if the result is not "Cancel" then
put printerName into tPrinter

put "lp -s -d "&&tPrinter&&" "&&tPath into tShell
launch tShell

put "rm "&&tPath into tShell
launch tShell -- Clean up and delete the temporary pdf file
end if

end Mouseup

This works well and to the user, appears just like the original. I use the standard printer selector window to choose a printer, which I then use within the unix lp command to actually do the printing. I use launch to execute the shell command rather than shell because it doesn't show the message window.

I think I might develop this into a generic printer function so I'd call it with the path and the id of the card to print.

Thank you so much for all your efforts and the information you gave me. It's been an interesting little challenge and I feel quite satisfied with the result. FYO I'm a 75 year old ex contract programmer, mainly C and Informix but I haven't done much coding for years so it stretched the brain cells a bit. The app is for the accounts and order processing for my retirement company, The Violin Company - you'll find it on the web. Nice thing about violins they don't get hacked etc.

Best wishes to you all and thanks again. - Dave Ingledew

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Unable to Print on Linux Mint

Post by bogs » Tue Mar 17, 2020 10:36 am

Gee Dave, you could at least have linked the name to the address :P

Is this it? https://www.violincompany.co.uk

Glad you figured out the coding problem young man :)
Image

DaveI
Posts: 8
Joined: Sat Mar 14, 2020 9:55 pm

Re: Unable to Print on Linux Mint

Post by DaveI » Tue Mar 17, 2020 2:20 pm

Hi Bogs,

Yes it is the correct address :-) I can't put links in messages on here - maybe because I'm a newby.

Now I've got another problem - but I haven't looked on the forum yet to see if there's an answer. The pdf rendering is a bit odd and at the moment it's only in one field, which is a customer name. If the name is Joe Bloggs all I get is J, if it's Bill Jones I get Bill J when I check the property of the field and show the contents it's exactly as I expect but by the time it gets to the pdf it's missing bits. I've also noticed it won't register Williams. If I exit from Livecode, go back in then it prints fine the first time and maybe the second. I'm wondering if there's a clear fields or something I need to do between prints. I've tried putting the name into another field on the card and it's just the same.

I'll trawl through the forum comments and see whether someone else has had problems -- It was going so well too :-)

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Unable to Print on Linux Mint

Post by bogs » Tue Mar 17, 2020 2:38 pm

Your linking inability will end in 2 more posts (as of your last post, 10 is the magic number heh).

Curious new issue, is the whole name visible in the field, or does it extend beyond the rect of the field?
Image

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Unable to Print on Linux Mint

Post by mwieder » Tue Mar 17, 2020 5:28 pm

FWIW, this bug report was logged two years ago:

https://quality.livecode.com/show_bug.cgi?id=21131

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Unable to Print on Linux Mint

Post by bogs » Tue Mar 17, 2020 5:58 pm

Nice update to the BR Mark, but having read it, I wonder how Panos managed to get it to print? I couldn't using Ubuntu 16.04. What a mystery :shock:
Image

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Unable to Print on Linux Mint

Post by mwieder » Tue Mar 17, 2020 6:02 pm

My wild-ass guess (without having any actual data to work with) is that there was already a /tmp/tmpprintfile.ps file in existence, since the print command doesn't delete it when it's done. If that's the case then, as I've discovered) the print-to-printer invocation of lp does print that file. But who know? I'm guessing that Panos won't remember from two years ago either.

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Unable to Print on Linux Mint

Post by bogs » Tue Mar 17, 2020 6:18 pm

LOL! I wouldn't be surprised if your dead on the mark, erm... Mark :D
Image

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1232
Joined: Thu Apr 11, 2013 11:27 am

Re: Unable to Print on Linux Mint

Post by LCMark » Tue Mar 17, 2020 7:03 pm

To be fair we could not reproduce that bug at the time - and there was no further input from anywhere else, so it would have been assumed to be an isolated incident. Of course, this is obviously not the case :)

I was the one who actually wrote the relevant patch which replaced the previous PS generation with the PDF printer - so I can be sure it definitely did work on the system I was using to write it at the time - and the code in the engine at least looks correct (okay, so its ugly and it shouldn't be using a fixed output path), so it is strange. (The only thing I can think of is that something environmental changed between 2015 and 2018 which renders the approach taken inappropriate!).

However, the important thing is that we now know that for some reason the pdf file isn't actually being generated in this case. So that's a step forward :)

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Unable to Print on Linux Mint

Post by bogs » Tue Mar 17, 2020 8:08 pm

I hope my remarks weren't taken as a slam on anyone, I just was genuinely curious. If anyone felt slighted, I apologize as that wasn't the intent :D
Image

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1232
Joined: Thu Apr 11, 2013 11:27 am

Re: Unable to Print on Linux Mint

Post by LCMark » Tue Mar 17, 2020 8:17 pm

@bogs: Not at all - I was just adding what I can remember to the mystery... In that I know it worked once (I can't recall what Linux distro/version I might have been using!) and thus it is plausible it still worked for Panos when he tried to reproduce... Although it could well be a case of @mwieder suggested - a non clean test environment. Of course, the question still remains why is the engine not able to write a file to /tmp/tmpprintfile.ps when it is clearly possible for such a thing to be there, and be piped to lp!

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Unable to Print on Linux Mint

Post by bogs » Tue Mar 17, 2020 8:30 pm

Just making sure, I know my ... ability to filter correctly is pretty terrible and is sometimes misunderstood <that REALLY is putting the best face on it, eh? :wink: >.

As far as when it went awry, I know from the testing during this thread that it worked <more or less> in 7.1.4, but not in 8.0.1, which was what prompted me to wonder why it would have worked for Panos in 8.1.9 :shock:

I have no doubt Mark hit it on the head, it isn't something almost anyone would think of and, as you say, it was working, there wasn't a mass complaint setup when it stopped, it appeared the easiest explanation was a one time occurrence.

As Richard Dawson said in "Running Man", all part of life's rich pattern...<sic>...Get used to it! Hee hee :D
Image

Post Reply