Pinting in Linux has me stumped
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Pinting in Linux has me stumped
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.
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.
- Attachments
-
- Linux.zip
- (204.28 KiB) Downloaded 120 times
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Pinting in Linux has me stumped
I am just gulping down my second cup of morning coffee
while the Linux box wakes up (Xubuntu 22.04).
while the Linux box wakes up (Xubuntu 22.04).
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Printing in Linux has me stumped
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
Last edited by richmond62 on Wed Jun 29, 2022 8:46 am, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Printing in Linux has me stumped
-
-
- Attachments
-
- printoid.livecode.zip
- Stack.
- (9.57 KiB) Downloaded 125 times
Re: Pinting in Linux has me stumped
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.
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.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Printing in Linux has me stumped
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.
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.
Last edited by richmond62 on Thu Jun 30, 2022 1:00 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Printing in Linux has me stumped
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
- Attachments
-
- printoid 2.livecode.zip
- Stack.
- (9.66 KiB) Downloaded 160 times
Last edited by richmond62 on Thu Jun 30, 2022 1:01 pm, edited 1 time in total.
Re: Pinting in Linux has me stumped
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
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
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Printing in Linux has me stumped
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.
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.
Last edited by richmond62 on Thu Jun 30, 2022 1:01 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Printing in Linux has me stumped
Next week I am on semi-holiday, so will have a new crack at the whip and see what I can manage.
-
- VIP Livecode Opensource Backer
- Posts: 9856
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Pinting in Linux has me stumped
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.
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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 9454
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Printing in Linux has me stumped
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.
-
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.
-
-
- VIP Livecode Opensource Backer
- Posts: 9856
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Pinting in Linux has me stumped
"32-bit": yes, IIRC modern 64-bit systems is where we've seen LC fail to print to the printer spool.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn