Skip to Content.
Sympa Menu

baslinux - [BL] Printing CLI with BL without lpr - using cat and netpbm

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: sindi keesan <keesan AT sdf.lonestar.org>
  • To: baslinux AT lists.ibiblio.org
  • Subject: [BL] Printing CLI with BL without lpr - using cat and netpbm
  • Date: Sun, 3 Apr 2005 18:26:35 +0000 (UTC)

1. HP Deskjet 500 and 600 series.
(1) Text cat filename.txt > /dev/lp0 but first:
(a) convert to DOS format (dos2unix -d) or CR won't work
(b) when the paper feed light starts to blink yellow hit that button in order to get the paper to feed, then it will print a page
(2) graphics with gs - convert image to pbm and then to ps (giftopbm, pbmtops
from netpbm) and print with gs drivers deskjet, djet500,etc. with a
script based on the deskjet.filter (see previous postings about this - deskjet.filter < filename.pdf > /dev/lp0) or by simply typing out
gs filename.ps -q -dSAFER -sDEVICE=deskjet -r300x300 -sPAPERSIZE=letter -sOutputFile=- - (all on one line). (3) graphics with netpbm but no gs -
(a)use 'ppmtopcl3' which is not part of netpbm but can be compiled using
pnmscale, ppmquant, and the netpbm libraries - David, want to try it? Search on ppmtopcl3 for the author's site.
(b) Or use pamscale or a p*mreduce program from netpbm to reduce to 1/4 width then print with netpbm's pbmtolj (pbmtolj filename.pbm > /dev/lp0) which otherwise prints 4x too wide and long. I have not tried this yet.

2. HP Deskjet 72* and 82* and 1000 series "Windows" printers, use the netpbm pbmtoppa program to print graphics:
ppmtoppa filename.ppm > /dev/lp0
There is also a non-netpbm pnm2ppa to print color.
To print text try pbmtotext to convert text to pbm, and then print that?

Only advantage of these blasted printers is they do 600 dpi which is handy if someone sends something semilegible that they scanned at 200 dpi using some stupid Windows program that makes scanned documents into pdf and uses a fax resolution default. Use xpdf's pdfimages to convert the pdf to pbm (which inverts black on white to white on black) or pdftopbm.
Netpbm probably has a program to invert white on black to black on white.

4. HP Laserjet and emulators (HP LJ IIP is all I have). 1) text - cat filename.txt > /dev/lp0 (DOS printers)
Don't know if you need to convert to DOS format or hit paper button.
2) graphics - try netpbm's pbmtolj text.pbm > /dev/lp0
(or pbmtops and gs as above with ljet2p driver - or other drivers if that does not work)

5. Paintjet - anyone have one of these?
pbmtopj - supposed to print to paintjet

6. Epson dot-matrix
pbmtoepson - for older epsons but did not work with my Panasonic KXP1124 with epson LQ emulation.

7. Epson C62
(1) Text - I don't recall if you first need dos2unix, but unless there is a unix end of line in the page, it prints then won't feed the page out unless you hit the paper button or else reboot. (Hit paper button AFTER printing, unlike the deskjet where you hit it BEFORE).
(2) Graphics with gs - driver epsonc (not epson or st800 which print garbage).
(3) Graphics with netpbm - pbmtoescp2? Have not tried this yet.

8. Epson Stylus Color 800
would not print as st800 and looks similar to the C62.

9. Postscript printers (anyone have one?)
pbmtolps filename.pbm > /dev/lp0 might work
I could not fine the pbmtops referred to in the docs, replaced by lps 'line postscript' format.

Printing graphics with dot-matrix - don't bother!

It took about 10 min to print out one page of pdf using gs. The dot-matrix is far easier to use with text than the deskjets - no need to convert from unix to DOS format, or press the paper feed button before or after printing. I will use a 2-way printer switch box to print text on dot-matrix and graphics on deskjet or epson inkjet or laserjet.
Dot-matrix ink does not fade or peel off.

Standard printing methods (without netpbm):

1. text, pdf or ps - as root, installpkg ghostscript (you will need 8.30 or later for the latest pdf 1.5 format), set up printcap and printer filter(s), insmod lp (lpd?) as root, login again as user, and print with 'lpr filename.txt' (choosing the printer with -P if you do not want the default.)

Or use xpdf to print pdf files (which involves gs and lp and user again).

2. image formats - do the above as far as 'login as user', load X and xv and print using xv (which has its own convertors, probably to ps)

(Steven, is the above correct?)

BL3 has no user and I could not get Xvesa to work in BL2 with user. Something to do with suid?

I had xv printing images in BL2 with 16-color X. It was a lot of work.


My experiences printing without X are monochrome only.
This is a black art.


When I have tested all the above printers with text and graphics I will fill in the details. Can anyone else contribute to this?

www.geocities.com/davidjmoberg has his pbmtox.tar.gz packages of the netpbm utilities compiled for BL3, and if used with BL2 you need to copy over libc-so* libm-so* and ld-linux* from BL3 to BL2.

There is one netpbm library that needs to go into /lib or /usr/lib (maybe he left instructions at the site).

I don't know why netpbm does not include a pbmtodj program. It has many printers I never even heard of.




Archive powered by MHonArc 2.6.24.

Top of Page