LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-11-2013, 11:06 PM   #1
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Rep: Reputation: Disabled
Question linux Printing: difference between ctrl+p and lpr


Dear sir,

can anyone please let me know what is the difference between ctrl+P and the lpr command with refrence to printig.
what actually happens when we press ctrl+p, what kind of printing does it use to get print n how does it differ from command like
Code:
lpr -P Printer filename
i am using ubuntu 11.04 n CUPS 1.4.3

thanks and regards
rohaan
 
Old 11-12-2013, 03:24 AM   #2
ericson007
Member
 
Registered: Sep 2004
Location: Japan
Distribution: CentOS 6.5
Posts: 482

Rep: Reputation: 85
Well, not sure about the specifics, but you directly invoke the print job via the command.

Ctrl+p on the other hand is the shortcut used in gui's and opens the pre print dialog where you can change options if required. When you click print then it should theoretically send the same command with additional option as specified by your selections. Other than that, both of them ends up with the same result, just different hoops to jump through.
 
Old 11-12-2013, 03:58 AM   #3
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by ericson007 View Post
Well, not sure about the specifics, but you directly invoke the print job via the command.

Ctrl+p on the other hand is the shortcut used in gui's and opens the pre print dialog where you can change options if required. When you click print then it should theoretically send the same command with additional option as specified by your selections. Other than that, both of them ends up with the same result, just different hoops to jump through.
Dear sir,

Thanks for reply

but i am trying to print a file containg hindi character it prints fine with the ctrl+p but with command line printing lpr it prints the garbage n unreadable things like box and symbols thats why i wanted to know the things related with both kind of printing.

Regards
Rohaan
 
Old 11-12-2013, 04:04 AM   #4
ericson007
Member
 
Registered: Sep 2004
Location: Japan
Distribution: CentOS 6.5
Posts: 482

Rep: Reputation: 85
By creating many threads, it wont solve your problem.
 
Old 11-12-2013, 04:27 AM   #5
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Unhappy

Quote:
Originally Posted by ericson007 View Post
By creating many threads, it wont solve your problem.
yes sir,

thats why i wanted to know the actual difference between the ctrl+p and lpr

thanks for reply

Reagrds
rohaan
 
Old 11-12-2013, 04:52 AM   #6
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,929

Rep: Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306
Actually you gave no information about your GUI (KDE, Gnome, which app...) therefore it is (almost) impossible to help you.
 
Old 11-12-2013, 05:29 PM   #7
Peverel
Member
 
Registered: May 2009
Location: Chelmsford, England
Distribution: OpenSuse 11.3, 11.4 and 12.2
Posts: 98

Rep: Reputation: 21
I assume you are using Linux. When you print using ctrl+P, the word processor or other program you are using converts the file from its internal format to postscript and places it in a CUPS output buffer. The printer daemon sends this to the printer, using the appropriate printer driver. If it is a postscript printer, no conversion is necessary. For many printers, including most inkjets, each page of output is prepared as a graphics file, so that it is printed essentially as a picture, not as text. That is why, if the first few bytes, which are the control characters to switch the printer to graphics mode, are missed, the rest comes out as garbage, because the printer assumes it is an ASCII file.

When you save a file, you do not save the output as printed, but a possibly rather complex format depending on the program used. For example, I use Lyx as an editor for Latex. A saved file contains many control strings, specifying things like character set, case and many other things. A word processor may well save it in a binary format. Now lpr applied to such a file will assume it is ASCII, turn into postcript and write it into a buffer. Naturally, the output is garbage, with certainly no Hindi characters in it.
 
3 members found this post helpful.
Old 11-12-2013, 10:34 PM   #8
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by Peverel View Post
I assume you are using Linux. When you print using ctrl+P, the word processor or other program you are using converts the file from its internal format to postscript and places it in a CUPS output buffer. The printer daemon sends this to the printer, using the appropriate printer driver. If it is a postscript printer, no conversion is necessary. For many printers, including most inkjets, each page of output is prepared as a graphics file, so that it is printed essentially as a picture, not as text. That is why, if the first few bytes, which are the control characters to switch the printer to graphics mode, are missed, the rest comes out as garbage, because the printer assumes it is an ASCII file.

When you save a file, you do not save the output as printed, but a possibly rather complex format depending on the program used. For example, I use Lyx as an editor for Latex. A saved file contains many control strings, specifying things like character set, case and many other things. A word processor may well save it in a binary format. Now lpr applied to such a file will assume it is ASCII, turn into postcript and write it into a buffer. Naturally, the output is garbage, with certainly no Hindi characters in it.
Dear sir,

Thank you very much for your very specific help. it helped me lot.
now i know what i can do to get the printing going through terminal

thanks everybody for all your help and valueable time.
when i will be done with solving this i will post the solution here how i did it with all your help

Thanks & Regards
rohaan
 
1 members found this post helpful.
Old 11-25-2013, 03:07 AM   #9
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Lightbulb

Dear all,

Thanks for all the replys

lpr is line printing utility so printing hindi or other language (UTF-8 data) from terminal we need to convert it to post script before we print for this i have used the following package
paps-0.6.8 - Linux
Code:
sudo apt-get install paps
then for printing one can do

Code:
paps --encoding=UTF-8 FileName | lpr -P PrinterName
Now it will print all the languages supported by the UTF-8

Note: we also can change the LC_ALL settings from locale to LC_ALL=en_US.utf8
we can search find the way to set the locale variables

Thanks & Regards
rohaan

THanks n regrads
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set up LPD/LPR printing system for sharing a postscript printer on Linux? nyk.mat Linux - Newbie 1 07-20-2013 08:20 AM
Printing under Linux. Cups, Apsfilter, lpr ? Sonic_Traveler Linux - Hardware 4 10-03-2011 04:52 PM
lpr printing issue sang_froid Linux - Server 3 05-21-2010 02:31 PM
printing with lpr davidcollins001 Linux - Software 2 05-22-2009 11:34 AM
How to lpd/lpr printing in Linux? backroger Linux - Newbie 3 09-03-2008 02:30 AM


All times are GMT -5. The time now is 01:06 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration