NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Websites on a Matrix Printer
Hi Herbt,
> [...]
> and the Cups printserver wasnt running that well (on Linux in the past)
> [...]
I had problems with cups too. In Linux I always install
lprng (with cups I'm never sure what the * it is doing), and
I'm happy with NetBSD's native lpd.
> [...]
> I guess any modern matrix printer will print graphically with the
> typeset of the webpages. But often the fontsize and -face is not right,
> sometimes very tiny, advertisment junk in there and so on.
>
> All I want is to use the internal typeset of such printers. This will
> print much faster and is all I need.
> [...]
> I will read into the printcap and see how to catch a printjob before it
> goes out to the printer. Lynx with the --dump option looks good. Or
> convert some postscript output to text?
> [...]
In printcap, you can define different printers corresponding
to a same physical printer. This allow you to create filters
to print several type of documents, and use a virtual
printer for each of them. Suppose you by a cheap oki ml182
turbo (and you say me where, of course). The printer will be
/dev/lpt0. Most X programs use ps output for printing, so
you need create a filter with gs. You can use the device
drivers oki182 or okiibm (ibm emulation). So in
/etc/printcap you must have something like this:
lp|local printer|Oki Ml182 Turbo:\
:lp=/dev/lpt0:sd=/var/spool/lpd/lp:lf=/var/log/lpd-errs:\
:sh:pl#66:pw#80:if=/usr/local/libexec/lpfilter:
ps|Ghostscript driver:\
:lp=/dev/lpt0:sd=/var/spool/lpd/ps:lf=/var/log/lpd-errs:\
:mx#0:sh:if=/usr/local/libexec/lpfilter-ps:
We are defined two virtual printers, one for plain text (lpr
-P lp) an other for ps and pdf (lpr -P ps). You can change
the pl and pw options and adapt it to your printer or test
with mx#0 (see printcap(5) man page). Now, we need to cre-
ate the filters.
/usr/local/libexec/lpfilter:
#!/bin/sh
# Treat LF as CR+LF
printf "\033&k2G" && cat && exit 0
exit 2
/usr/local/libexec/lpfilter-ps:
#!/bin/sh
# Treat LF as CR+LF
printf "\033&k2G" || exit 2
# Print the postscript file
/usr/pkg/bin/gs -dSAFER -dBATCH -dQUIET -dNOPAUSE -q -sDEVICE=oki182 \
-sOutputFile=- -sPAPERSIZE=a4 - && exit 0
exit 2
These are basic filters following the NetBSD guide. Consult
the guide (Chapter 12) and make sure the directories and
files exists and have the right permissions.
The problem with a graphic browser is when you print a web
page, it converts the rendered HTML page to ps, and then you
have to print a ps file with graphics and a lot of mess. If
you want to print a fast text copy you can convert the ps to
plain text using gs or poppler's pdftotext, but the result
isn't going to be satisfactory. The best options is render
the HTML document directly to text. With elinks (elinks has
best HTML rendering than lynx and other grate improvements,
even javascript; in fact, is my preferred browser):
elinks -dump URL | lpr
lp is the default printer, you can change it setting the
environment variable PRINTER. You can set the color scheme,
and the dump's charset, for example:
elinks -dump -dump-color-mode 2 -dump-charset iso-8859-15 URL | lpr
You can use it in a key binding, so I think that resolve
your questions.
Regards,
trebol.
Home |
Main Index |
Thread Index |
Old Index