General discussion

Locked

Printing Configuration Files

By McKayTech ·
Okay, I'm having a brain fade here and I hope someone can help me out. I'm running RH Linux v6.2 and have a networked LaserJet4 printer and need to print some plain-vanilla old script and configuration files for documentation purposes.

I've tried groff -me test.doc | lpr and every other variant I could think of using pr, groff, cat and so on.

Anyone have a quick and easy way to print these plain-ASCII files so they look like they do on the terminal (in other words, no stairstepping or other formatting problems that result in making it difficult to read)?

Thanks in advance!

paul

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Printing Configuration Files

by ddiall In reply to Printing Configuration Fi ...

The HP printers, as DOS, use CR+LF to delimit the end of a line. Unix/Linux systems use only LF.

You must add a CR (carriage return) before (or after) the each LF (line feed). To accomplish this use standard tools like 'sed', 'awk' or maybe 'tr'...

The best way is to create a print queue that uses ghostscript to convert the plain ASCII text to LaserJet format. Use RedHat's printtool for this. By hand, do it like this:

# gs -DEVICE=ljet4 -OUTPUTFILE=test.lj4 test.txt </dev/null

Afterthis feed the file test.lj4 to the printer.

Collapse -

Printing Configuration Files

by McKayTech In reply to Printing Configuration Fi ...

I tried this and got a return message of -dvar=name requires null, true or false.

Collapse -

Printing Configuration Files

by McKayTech In reply to Printing Configuration Fi ...

I finally found the answer. In the input queue in Printtool, I clicked "fix stair-stepping" and then used 'pr l60 "textfile" | lpr'.

paul

Collapse -

Printing Configuration Files

by ddiall In reply to Printing Configuration Fi ...

Yeah right, I forgot two things: first, you must put 's' after the dashes (-s); second, ghoscript only accepts PostScript as input files:

# gs -sDEVICE=ljet4 -sOUTPUTFILE=test.lj4 test.ps </dev/null

Thus you should convert to PostScript first with a tool like text2ps.

Of course, the adding a CR after each LF in your input file and piping it to the printer is a more elegant solution. Unfortunately, I cannot recall how to do it with standard unix tools, right now.

Meanwhile, I'd suggest you (as in the first answer) creating a print queue with RedHat's printtool to convert the input into the native language of HP LaserJet printers: PCL.

Collapse -

Printing Configuration Files

by McKayTech In reply to Printing Configuration Fi ...

Thanks! I appreciate the additional information. Printtool with it's "fix stairstepping" option did the trick.

Collapse -

Printing Configuration Files

by McKayTech In reply to Printing Configuration Fi ...

This question was closed by the author

Back to Linux Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums