Register
It is currently Sat Dec 20, 2014 11:32 am

[newbie]printing from bash [SOLVED]


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Sat Jan 22, 2011 11:51 am   
User avatar

Joined: Sat Jan 22, 2011 11:42 am
Posts: 11
Location: Ljubljana, Slovenia
Hello BashScripts,

This is my first post, hope I got it in right section, if not... well sorry admin.

I am new to bash, and I am looking for some basic jobs to be done by shell.
I have a lot of questions, but let me start with this one;

Right now I am interested in printing to a printer.
I searched the net, but all I got was printing in bash, as output.
I am also not a native English speaker, so this might be a source of my wrong research...

So, how do I print a file to printer from bash shell?

Thank you.


Last edited by Seiduna on Thu Feb 24, 2011 1:31 am, edited 1 time in total.

Top
 Profile  
 PostPosted: Sun Jan 23, 2011 12:44 am   
User avatar

Joined: Sat Dec 11, 2010 5:27 pm
Posts: 15
Location: NSW, Australia
Code:
lpr filename


http://ss64.com/bash/lpr.html

Some of the many, many references on bash. Get used to looking up Google!

http://ss64.com/bash/
http://www.gnu.org/software/bash/manual/bashref.html#Top

Hope this helps

Alan


Top
 Profile  
 PostPosted: Fri Feb 11, 2011 6:47 am   
User avatar

Joined: Sat Jan 22, 2011 11:42 am
Posts: 11
Location: Ljubljana, Slovenia
Hello Mr. Alan,

Sorry for delayed reply, I just could not spare time for this hobby of mine...

So, the thing was, that I did not set the printer. :)

After that, it is printing, but I have major issue...
It prints text files (.txt) and .pdf just fine.
And .png files (pictures) it prints on 4 papers.
I guess I have to set some parameters for this.

But I can not print OO file (.odt) or MS offoce (.doc) files.
If I look at CUPS I can see that those print jobs are under "Completed jobs"
as if they were printed, when they are not...

Code:
grom@C6820s ~ $ lpr Desktop/pogled.png
grom@C6820s ~ $ lpr Desktop/Programerska\ naloga.pdf
grom@C6820s ~ $ lpr Desktop/Programerska\ naloga.doc
grom@C6820s ~ $ lpr Desktop/Programerska\ naloga.odt


looking at CUPS:
HP_Deskjet_F2200_series-22 Programerska naloga.odt grom 15k 1 completed at
Fri 11 Feb 2011 01:37:09 PM CET
HP_Deskjet_F2200_series-21 Programerska naloga.doc grom 27k 1 completed at
Fri 11 Feb 2011 01:36:36 PM CET
HP_Deskjet_F2200_series-20 Programerska naloga.pdf grom 32k 1 completed at
Fri 11 Feb 2011 01:36:23 PM CET
HP_Deskjet_F2200_series-19 pogled.png grom 306k 4 completed at
Fri 11 Feb 2011 01:36:04 PM CET



Thank you


Top
 Profile  
 PostPosted: Fri Feb 11, 2011 5:25 pm   
User avatar

Joined: Sat Dec 11, 2010 5:27 pm
Posts: 15
Location: NSW, Australia
You will need to use the appropriate program to print these files.

.odt - use Open Office
.doc - use Microsoft Word or Open Office
.pdf - use Adobe Acrobat Reader (Windows) or Foxit or Okular (Linux) or similar
.png - use a Graphics program like Gwenview (or similar)

Each or these files contain special codes such as formatting codes so they can not be sent directly to a printer using lpr. The programs will also send the correct printer control codes with the documents when printing which lpr does not.

Use lpr for plain ASCII text files.

Check this out - http://tldp.org/HOWTO/Printing-HOWTO/

Hope this helps

Alan


Top
 Profile  
 PostPosted: Sat Feb 12, 2011 11:06 am   
User avatar

Joined: Sat Jan 22, 2011 11:42 am
Posts: 11
Location: Ljubljana, Slovenia
Ola Mr, Alan,

aha I see, printing such files is not supported via bash shell.

I will try to search through your link, and find a possible solution, but it is whole manual, kheh, so it might take me a while.

For now I am happy to print txt and pdf files, well I was interested in txt files mostly, but I thought that printing oo files or such was just the thimg of parameter settings.

Anyway, I would like to thank you for your time and input, and I will now open another thread, and hope to see you there!

Kind regards, Goran


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP