Printing an image

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

Post Reply
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Printing an image

Post by MaxV » Wed Feb 01, 2017 12:35 pm

If I had to print an image, what would be the best procedure?
I don't need to modify it, just send the JPG file to the printer.
on Linux is very easy, just use:

Code: Select all

put shell("lpr  myfile.jpg")
but on Windows or Mac?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Printing an image

Post by AxWald » Thu Feb 02, 2017 10:45 am

Hi,

on Windows, try:

Code: Select all

put shell("mspaint /p c:/folder/subfolder/filename")
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Printing an image

Post by AndyP » Thu Feb 02, 2017 12:24 pm

I was surprised to find that on Windows that you cannot print images from files directly from LiveCode.

So here is my solution to this which involves printing a card of a stack scaled to an image.

I've put a blog post and download of files here.

http://2108.co.uk/printing-file-images- ... -solution/
Andy .... LC CLASSIC ROCKS!

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: Printing an image

Post by AxWald » Thu Feb 02, 2017 4:06 pm

Hi,

never tried printing images from LC ;-)
I'd usually have tried to display it on a card, then print the card - but in this case, I felt a substitute to the given Linux cmd was asked for, and using paint instead of lpr should do the job ...

Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: Printing an image

Post by [-hh] » Thu Feb 02, 2017 5:00 pm

Max, on MacOS (here 10.12.3)

Code: Select all

put shell("lpr myfile.jpg")
works also, uses CUPS. Good help file (more than from 'man lpr').
shiftLock happens

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Printing an image

Post by MaxV » Mon Feb 06, 2017 12:10 pm

Hi all,
thank you for your replies, I found on internet this command:

Code: Select all

rundll32 C:\WINDOWS\system32\shimgvw.dll,ImageView_PrintTo "c:\mydir\my.bmp" "Fictional HP Printer"
Do you think that is better than passing trough the MSPaint software? Or is it the same?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Printing an image

Post by MaxV » Mon Feb 06, 2017 2:12 pm

AxWald wrote:Hi,

on Windows, try:

Code: Select all

put shell("mspaint /p c:/folder/subfolder/filename")
Have fun!
Hi AxWald,
thank you for your code, you can choose also the printer with:

Code: Select all

put shell("mspaint /pt c:/folder/subfolder/filename  printerName " )
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply