how to print a text/plain document in CUPS printer without using raw option

4.6k views Asked by At

I am using a CUPs command to print the pages of documents,But it is printing all the pages ignoiring the pages option. After some investigation I came to know raw option is overwriting the pages option , Please tell me how to print the pages without using raw option ,If I am not using this option , text file not supporting error is coming ,Here is my code :

system("lpr -P AFSCMSRPRNT3  -o pages=1,2,6  -o raw -T test_womargin abc.txt"
1

There are 1 answers

3
Marcus Müller On

Plain text files don't really specify how things should be printed, and thus aren't allowed.

Try to convert the text to any usable format first. There's a popular tool a2ps which should be available for every linux distribution in the world. Try that!

EDIT you seem to be confused by the word "convert": What I meant is that instead of printing the text file, you print a postscript file generated form that; something that you can get by doing something like

a2ps -o temporaryoutput.ps input.txt

and then

lpr -P AFSCMSRPRNT3  -o pages=1,2,6 -T test_womargin temporaryoutput.ps