fixing the stair case when printing

fixing the stair case when printing

Post by guide.. » Wed, 05 Nov 1997 04:00:00



I'm using a panasonic kx-p6500 laserjet printer and when I try to print
a text file it prints it out as a stair case.  I've tried to use a hp
laserjet 4 and hp laserjet 2p and still get the stair case effect. I
need to put a carriage return code after each line but I don't know the code
to do that.  Can someone please help me, thanks
to do that.  Can someone please help me, thanks.

 
 
 

fixing the stair case when printing

Post by Jamie Hoglun » Thu, 06 Nov 1997 04:00:00


: I'm using a panasonic kx-p6500 laserjet printer and when I try to print
: a text file it prints it out as a stair case.  I've tried to use a hp
: laserjet 4 and hp laserjet 2p and still get the stair case effect. I
: need to put a carriage return code after each line but I don't know the code
: to do that.  Can someone please help me, thanks

Some printers have a special control code that you can send to put them
in a mode where a newline is a linefeed (instead of a cr lf pair).

But I fire up perl to handle it.

Real basically, in perl:

-----
#!/usr/bin/perl
while(<STDIN>){
    chop;
    print "$_\r\n";

Quote:}

-----

My filter needs a bit of explaining...

We read the first line of input, to determine if it's postscript or not.

I'm using one of those printers that uses a "color cartridge", but usually
it's black and white. Ghostscript has different arguments for color. So we
use a flag file to tell ghostscript we're in "color".

The variable $gs is the actual gs command used for color or b&w.

I like to have an audio file played to tell me when a print job has
started and ended. (different for color)

If it's NOT postscript (as is usually the case) I have perl remove the
linefeed, add a carriage return and a line feed.

When the print job is over, I have it send a form feed (and play another
sound)

So here's my messy (but fairly simple) print filter, you'll want to change
the line that says system("/usr/local/bin/lps $sound");  to a command
that plays a sound file, (or remove it completely), change the $gs
to whatever you use. (maybe you never have to deal with color cartridges,
I dunno)

In /etc/printcap set your if= to whatever_you_save_this_filter_as make
sure to chmod +x it, (and look it over _real_ good, as I believe it runs
as user root).

Good luck! Let me know if you use it, or have any questions, ok?

Jamie

----
#!/usr/bin/perl
$Line=<STDIN>;
$|=1;
if( -f "/var/spool/lpd/color" ){
    $gs='/usr/bin/gs -dSAFER -q -dBitsPerPixel=16 -sDEVICE=cdeskjet -sOutputFile=- -sShingling-1 -';
    $sound_begin="print_color";

Quote:}else{

    $gs='/usr/bin/gs -dSAFER -sOutputFile=- -q -sDEVICE=deskjet /var/spool/lpd/gamma.ps -';
    $sound_begin="print_bw";

Quote:}

if($Line=~ /^\%\!/){   # look at first line, if %!, it's postscript
  open(GS,"| $gs");
  &play($sound_begin);
  print GS $Line;
  while(<STDIN>){
      print GS $_;
  }
  close(GS);
  &play("print_end");
Quote:}else{                     # File is assumed to be plaintext.

  &play("print_start");
  chop $Line;              # Add Linefeeds
  print "$Line\r\n";
  while(<STDIN>){
      chop;
      print "$_\r\n";
  }
  print "\014";         # formfeed.
  &play("print_end");
Quote:}

sub play(){
    my($sound)=shift;
    system("/usr/local/bin/lps $sound");
Quote:}


 
 
 

fixing the stair case when printing

Post by Anyone for thermonuclear tenni » Thu, 06 Nov 1997 04:00:00


On 4 Nov 1997 05:46:51 GMT, a small green fish snuck into
guidedog's internet account in order to express the following:

Quote:> I'm using a panasonic kx-p6500 laserjet printer and when I try to print
> a text file it prints it out as a stair case.  I've tried to use a hp
> laserjet 4 and hp laserjet 2p and still get the stair case effect. I
> need to put a carriage return code after each line but I don't know the code
> to do that.  Can someone please help me, thanks

My way of dealing with it:

---

#!/bin/sh
if [ -z "$1" ]; then
echo "usage: $0 file [file file ...]"
exit
fi
for i in $*; do
if [ -f $i ]; then
cat $i | todos | lpr
fi
done

---

It ain't exactly pretty but it does the job for text.

If anyone has a nice simple filter (I'm not going to fire up perl
just to add \r to every line) that works as "if" then I want to know.
'todos' chokes on a "-w132" when I try to use it that way.  I've no
idea where that option's coming from.  It's nowhere in my printcap.

 
 
 

1. fixing stair case when printing

I having problems when I print out a text file to my printer.  When I print
out
a text file it prints out like a stair case.  I have redhat linux version
5.0 but
my printer is not on the list of printers and I told it to fix stair case.
I'm using a Panasonic kx-p6500.   Can someone please help me.  Thanks.

David Robinson

2. Dont know what I am looking at...

3. fixing the stair case effect when printing

4. Installing FreeBSD on a WIN95 platform

5. Printing Problem: Stair-Stepping when printing text

6. 3rd party HD & RAM upgrade recommendations??

7. Stair case effect in my Canon BJC-210

8. !!! pnpdump will not output to isapnp.conf...HELP!!

9. Help: Convert L/Case to U/Case when Printing

10. Stair stepping in print jobs

11. Stair printing on HP Laserjet III from SunOS 4.1.3

12. Stair-stepped printing

13. How to remove stair stepping when printing?