LinuxQuestions.org

LinuxQuestions.org (http://www.linuxquestions.org/questions/index.php)
-   Programming (http://www.linuxquestions.org/questions/forumdisplay.php?f=9)
-   -   linux Printing: difference between ctrl+p and lpr (http://www.linuxquestions.org/questions/showthread.php?t=4175484292)

rohaanembedded 11-11-2013 11:06 PM

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

ericson007 11-12-2013 03:24 AM

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.

rohaanembedded 11-12-2013 03:58 AM

Quote:

Originally Posted by ericson007 (Post 5063018)
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

ericson007 11-12-2013 04:04 AM

By creating many threads, it wont solve your problem.

rohaanembedded 11-12-2013 04:27 AM

Quote:

Originally Posted by ericson007 (Post 5063042)
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

pan64 11-12-2013 04:52 AM

Actually you gave no information about your GUI (KDE, Gnome, which app...) therefore it is (almost) impossible to help you.

Peverel 11-12-2013 05:29 PM

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.

rohaanembedded 11-12-2013 10:34 PM

Quote:

Originally Posted by Peverel (Post 5063397)
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

rohaanembedded 11-25-2013 03:07 AM

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


All times are GMT -5. The time now is 03:38 PM.