Pinting in Linux has me stumped

Deploying to Linux? Get penguinated here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
djkesler
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 55
Joined: Tue Jun 01, 2010 10:37 pm

Pinting in Linux has me stumped

Post by djkesler » Wed Jun 29, 2022 1:31 am

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.
Attachments
MacPreview.png
Mac screenshot of card.png
Linux.zip
(204.28 KiB) Downloaded 99 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Pinting in Linux has me stumped

Post by richmond62 » Wed Jun 29, 2022 8:08 am

I am just gulping down my second cup of morning coffee
while the Linux box wakes up (Xubuntu 22.04).

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Printing in Linux has me stumped

Post by richmond62 » Wed Jun 29, 2022 8:42 am

LinuxPreview.png
-
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.
Last edited by richmond62 on Wed Jun 29, 2022 8:46 am, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Printing in Linux has me stumped

Post by richmond62 » Wed Jun 29, 2022 8:45 am

Screenshot_2022-06-29_10-19-11.png
-
printout.png
-
Attachments
printoid.livecode.zip
Stack.
(9.57 KiB) Downloaded 91 times

djkesler
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 55
Joined: Tue Jun 01, 2010 10:37 pm

Re: Pinting in Linux has me stumped

Post by djkesler » Wed Jun 29, 2022 8:05 pm

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.
Attachments
Flowers.jpg

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Printing in Linux has me stumped

Post by richmond62 » Wed Jun 29, 2022 8:54 pm

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.
Last edited by richmond62 on Thu Jun 30, 2022 1:00 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Printing in Linux has me stumped

Post by richmond62 » Wed Jun 29, 2022 9:52 pm

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.
Attachments
printoid 2.livecode.zip
Stack.
(9.66 KiB) Downloaded 132 times
Last edited by richmond62 on Thu Jun 30, 2022 1:01 pm, edited 1 time in total.

djkesler
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 55
Joined: Tue Jun 01, 2010 10:37 pm

Re: Pinting in Linux has me stumped

Post by djkesler » Wed Jun 29, 2022 10:15 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Printing in Linux has me stumped

Post by richmond62 » Thu Jun 30, 2022 11:14 am

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.
Last edited by richmond62 on Thu Jun 30, 2022 1:01 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Printing in Linux has me stumped

Post by richmond62 » Thu Jun 30, 2022 11:59 am

Next week I am on semi-holiday, so will have a new crack at the whip and see what I can manage.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Pinting in Linux has me stumped

Post by FourthWorld » Thu Jun 30, 2022 8:42 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Printing in Linux has me stumped

Post by richmond62 » Fri Jul 01, 2022 8:39 am

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
SC.jpg (9.49 KiB) Viewed 11110 times

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Pinting in Linux has me stumped

Post by FourthWorld » Fri Jul 01, 2022 7:27 pm

"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

Post Reply

Return to “Linux”