Page 1 of 1
Pinting in Linux has me stumped
Posted: Wed Jun 29, 2022 1:31 am
by djkesler
I have a program that has been in distribution for 5 years on Mac and PC. I have been asked to build a Linux version. Most of the changes were insignificant. BUT, printing from Ubuntu 16.04 from LC is way over my head. My users can live with printing to a pdf and then using some other program to actually send it to the printer, but I can't get LC to reliably make a pdf file that renders the layout on the card that is being printed.
In this particular case I build each page and print it with the line:
print card ccard of stack "PortraitPrint"
where ccard is the name of the particular formatted card I am using.
If you look at the screenshot files from Linux and Mac, they are essentially identical.
However the pdf files that are produced by I suppose "PDFPrinter" extension, produce wildly different outputs.
Is there anyway to solve this problem?
Thanks,
David Kesler
sorry for the way the files were loaded. I guess that only three relatively small files can be uploaded. I had to improvise. The files marked "Preview" are the actually pdf outputs.
Re: Pinting in Linux has me stumped
Posted: Wed Jun 29, 2022 8:08 am
by richmond62
I am just gulping down my second cup of morning coffee
while the Linux box wakes up (Xubuntu 22.04).
Re: Printing in Linux has me stumped
Posted: Wed Jun 29, 2022 8:42 am
by richmond62
-
What I can see now (as it was worthless on my telephone) is that Linux is playing silly buggers with text.
Um:
"On Mac OS and Windows systems, the print command uses the current printer. On Unix systems, the print command creates a PostScript file and runs the program specified in the printCommand property, with the file as input. "
https://livecode.fandom.com/wiki/Print
Q1. Where is your filepath to the pdf file you want to create?
Code: Select all
on mouseUp
set the defaultFolder to specialFolderPath("desktop")
put specialFolderPath ("desktop") & "/Flowers.pdf" into wherePDF
open printing to pdf wherePDF
set the vis of me to false
wait 5 ticks
print card "K1" of stack "printoid" into 0,0,600,600
set the vis of me to true
close printing
end mouseUp
certainly works round these parts.
Re: Printing in Linux has me stumped
Posted: Wed Jun 29, 2022 8:45 am
by richmond62
Re: Pinting in Linux has me stumped
Posted: Wed Jun 29, 2022 8:05 pm
by djkesler
Richmond
Thanks for the reply.
I'm not sure how to verify this:
On Unix systems, the print command creates a PostScript file and runs the program specified in the printCommand property, with the file as input.
I am using the print to pdf 'exactly' like in the app you sent.
Thanks for the little app. Here's what I got from it.
Re: Printing in Linux has me stumped
Posted: Wed Jun 29, 2022 8:54 pm
by richmond62
Something odd there.
of course Xubuntu uses XFCE as its "raincoat", while Ubuntu uses something else
whether that has got anything to do with the different results we get, I just do not know.
Re: Printing in Linux has me stumped
Posted: Wed Jun 29, 2022 9:52 pm
by richmond62
Code: Select all
on mouseUp
import snapshot from fld "ff"
set the name of the last control to "XXX"
set the defaultFolder to specialFolderPath("desktop")
put specialFolderPath ("desktop") & "/FlowersX.pdf" into wherePDF
open printing to pdf wherePDF
set the vis of me to false
set the loc of img "XXX" to the loc of fld "ff"
wait 5 ticks
print card "K1" of this stacka into 0,0,600,600
set the vis of me to true
close printing
delete img "XXX"
end mouseUp
This one cheats by taking snapshots of fields.
Re: Pinting in Linux has me stumped
Posted: Wed Jun 29, 2022 10:15 pm
by djkesler
Richmond,
Solved!
I think I figured out where I was going wrong. I used the following:
put "evince"&&"/home/documents/preview.pdf" into x
shell(x)
that ran the pdf viewer "evince" and displayed the contents of the LC pdf file correctly. I was then able to print from the "evince" window to my printer.
Thank you for your help. It sped me along knowing the it was possible to print in linux our of LC.
Thanks again!
David Kesler
Re: Printing in Linux has me stumped
Posted: Thu Jun 30, 2022 11:14 am
by richmond62
I am glad you found a method that worked on your computer with your chosen distro of GNU-Linux.
HOWEVER:
1. You have NO idea what PDF viewer your end-user might have on their particular GNU-Linux install.
2. My method produces a readable PDF document, but, because it does that by snap-shotting fields it
will NOT contain embedded text.
One of very, very few useful things I remember from my MSc at the "University" of Abertay was that it was extremely unwise
for a programmer to leverage external programs just because it was impossible to rely on end-users having any of those
external programs installed on their systems.
SO, until we find a script that will export a print-ready PDF on Linux this problem has not been solved.
Re: Printing in Linux has me stumped
Posted: Thu Jun 30, 2022 11:59 am
by richmond62
Next week I am on semi-holiday, so will have a new crack at the whip and see what I can manage.
Re: Pinting in Linux has me stumped
Posted: Thu Jun 30, 2022 8:42 pm
by FourthWorld
Printing to printers from LC on most Linux distros hasn't worked in some years. I don't think it's been officially deprecated, just low enough in the priority queue that I see no fix on the horizon.
However, I have been able to print to PDF fairly reliably on Ubuntu, using LC's "print...to PDF".
If that's not working for you I'm interested in learning why, and exploring ways it may become workable for you.
Re: Printing in Linux has me stumped
Posted: Fri Jul 01, 2022 8:39 am
by richmond62
I ran my first stack on 2 other machines:
1. A 32-bit wonder running Ubuntu 18.04 (e.g. 'crap' in my school).
2. A 64-bit thing running Xubuntu 20.10
and everything worked without a hitch.
What this "exercise" has proven, even if nothing else, is how variable GNU-Linux systems are,
and how difficult it is to predict what a result will be on any one machine.
-

- SC.jpg (9.49 KiB) Viewed 31375 times
Re: Pinting in Linux has me stumped
Posted: Fri Jul 01, 2022 7:27 pm
by FourthWorld
"32-bit": yes, IIRC modern 64-bit systems is where we've seen LC fail to print to the printer spool.