HP Deskjet 1000c

Stephen L Arnold arnold.steve at ensco.com
Mon Apr 26 16:32:11 GMT 1999


When the world was young, Brett Worth <brettw at sgi.com> carved some 
runes like this:  

> > The print jobs make it, and start coming out the printer, but where ink
> > stops getting laid on paper, the form stops.  I guess I need a form
> > feed.
> 
> There are a couple of ways to deal with this.  First you can usually make
> the Windows printer configuration send it's own form feed.  This is the
> prefered solution.  There's usually a check box somewhere to do this.
> 
> Alternatively you can make Samba do it:
> 
> print command =  "lpr -r -P %p %s ; echo \014"

I guess I wasn't very clear in my previous post; you probably don't 
want to do this manually every time you print, and I would say 
adding a filter script is cleaner than modifying the print command 
in the smb.conf file.  Printers have various ways to do CR/LF, 
formfeed, etc; the PCL commands (escape codes) should be well 
documented in your HP manual.  Here is a way to do it with sed and 
escape codes (assumes the shell is bash):

#!/bin/sh
#
#  Add carriage returns to text files using sed,
#  and force a formfeed:
#
sed -e s/$/
echo -ne \\f

You can pipe a text file through the above and then to lpr, or you 
can install it as an input filter.  You can also do it without sed; 
this is specific to an HPLJ III (PCL5), but should work on any PCL 
printer:

#!/bin/sh
#
echo -ne \\033\&k2G
cat -
echo -ne \\f

The basic HP manual has an appendix listing the PCL commands 
(escape sequences) but they are explained in detail only in the 
Technical Reference Manual (we had to send away for it).

Here is one for formatted text (only a masochist would do this for 
fun; hey, wait a minute...)

#!/bin/sh
#
# Filter for LaserJet 4MPlus to treat LF as CRLF and add some text
# formatting (uses PCL-5 escape codes).
# The "echo -ne" assumes that /bin/sh is actually bash, while the
# 033 is ascii char #27 (ESC) in octal.
#
echo -ne \\033\E # reset
echo -ne \\033\&k2G # treat lf as cr-lf
echo -ne \\033\&l0O # portrait mode
echo -ne \\033\&l8D # 8 lines per inch
echo -ne \\033\&l8E # 1" top margin (8 lines)
echo -ne \\033\&l66F # 66 lines per page
echo -ne \\033\&a10L # 1" left margin
echo -ne \\033\(10U # PC-8 symbol set
echo -ne \\033\(s3T # courier
echo -ne \\033\(s0P # fixed
echo -ne \\033\(s0S # upright
echo -ne \\033\(s0B # medium
echo -ne \\033\&k4S # 12 char. per inch
cat -
# echo -ne \\f # form feed
echo -ne \\033\E

> Brett Worth CLE (Certifiable Linux Enthusiast)

I like this; can I be certifiable too?  Where are the requirements 
defined?  Is there an exam?

Steve

******************************************************************
Stephen L Arnold                      http://www.rain.org/~sarnold
#include <std_disclaimer.h>
******************************************************************


More information about the samba mailing list