You are not logged in.

#1 2010-11-12 18:07:39

piie
Member
Registered: 2007-02-20
Posts: 33

cups printing font issue. Laserjet P1005 [SOLVED]

Hi,

since some weeks I've got the Problem, that the fonts are really screwed up when printing in landscape mode, have a look at this:
http://piie.net/files/print.jpg
In this case I printed two pages on one paper. When printing it normal it works fine.

My specs:
printer:  HP laserjet p1005
cups up to date
Driver:    HP LaserJet P1005 Foomatic/foo2xqx (recommended) (grayscale, 2-sided printing)

does anybody have an idea how to fix it?

thanks and kind regards,
--peter,

Last edited by piie (2010-12-04 20:36:32)

Offline

#2 2010-12-01 04:11:06

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: cups printing font issue. Laserjet P1005 [SOLVED]

Hi,

I just want to let you know that I have the same printer model and the same problem. It's late now but tomorrow I'll get back to you with details such as logs, configs and my research so far. In the meantime, set LogLevel debug in cupsd.conf and post or send me the output for a print job so we can compare.

Offline

#3 2010-12-01 14:49:58

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: cups printing font issue. Laserjet P1005 [SOLVED]

At this point, I think the problem is ghostscript. Check this out :

bash$ lp -o landscape somepicture.jpg
# good print

Now take a file with text (for example an OpenOffice.org writer document) and print it "as a file" in the print dialog. It will produce a poststcript file.

bash$ gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=letter -r1200x600 -sDEVICE=pbmraw -sOutputFile=test.pbmraw test.ps
# This produces ugliness. Open the .pbmraw file with GIMP. This is what foo2xqx recieves as input in every usual print job so it is not foo2xqs's problem.
# I found this command at the foot of man 1 foo2xqx.
bash$ gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=letter -r600x600 -sDEVICE=pbmraw -sOutputFile=test.pbmraw test.ps
#This produces something good on screen but the printed output is trash.
# I did :
bash$ foo2xqx -r600x600 < test.pbmraw > test.xqx
bash$ cat test.xqx > /dev/usb/lp0
# It prints but it seems that -r 600x600 is not a valid resolution. Or maybe I have to adjust something else in the gs command.
bash$ gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=letter -r600x600 -sDEVICE=pbmraw -sOutputFile=test.pbmraw test.ps
# With the same 600x600 resolution .pbmraw :
bash$ foo2xqx -g 5100x6600 -r 1200x600 < test.pbmraw > /dev/usb/lp0
bash$ cat test.xqx > /dev/usb/lp0
# PARTIAL SUCCESS!!
# The text is no longer horizontally stretched but the result is vertically compressed by a factor of 2.

I'll resume at this point later. I have to go.

Offline

#4 2010-12-02 04:44:20

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: cups printing font issue. Laserjet P1005 [SOLVED]

One more piece of the puzzle :

  1. I printed a portrait document as a file

  2. processed it with :

    gs -dBATCH -dSAFER -dNOPAUSE -sPAPEERSIZE=letter -r1200x600 -sDEVICE=pbmraw -sOutputFile=portrait.pbmraw portrait.ps
  3. opened portrait.pbmraw in GIMP

  4. rotated it clockwise,

  5. scaled it by swapping the x and y dimentions (not preserving proportions)

  6. then converted it back to a 1 bit indexed mode image,

  7. save it as a PBM, selected raw instead of ASCII encoding.

Thus I ended up with a 10200x6600 raw pbm image to feed through foo2xqx :

foo2xqx -g 10200x6600 -r 1200x600 < fake_landscape.pbm > /dev/usb/lp0

And the printed result is beautiful! cool
So: when foo2xqx is fed a well formated pbm raw image, it will produce a beautiful landscape print...

My next step is to find out why gs does not behave properly when asked to scale fonts in landscape orientation. hmm

Offline

#5 2010-12-03 04:29:58

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: cups printing font issue. Laserjet P1005 [SOLVED]

I achieved another milestone!
First, I print to a file as usual.
Then I issue this command :

ps2ps test_A.ps test_B.ps

ps2ps is part of the ghostscript package. It converts the postscript program to a simpler, streamlined code, or something. I don't understand yet what happens exactly but it doesn't seem so unusual in a printing process.

gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=letter -r1200x600 -sDEVICE=pbmraw -sOutputFile=test_B.pbmraw test_B.ps
# same as usual, but this time, I get the right font scaling and everything as checked with GIMP.
# Print with :
foo2xqx -r1200x600 -g10200x6600 -p1 < test_ps2ps.pbmraw > /dev/usb/lp0

cool Yeah, I got a good (manual, slow, but working) path from postscript to print. But it's late now. I have to go offline. Next step is to figure out how to make CUPS use ps2ps or wether it even should use ps2ps.

Offline

#6 2010-12-04 04:01:06

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: cups printing font issue. Laserjet P1005 [SOLVED]

My Solution

There is a patch at the end of this post.

My solution for now is to edit /usr/bin/foo2xqx-wrapper.
Change line 1:

FROM : #!/bin/sh
TO : #!/bin/bash

because the syntax I know is only for bash.

Find these lines near the bottom of the script:

foo2zjs-pstops $PSTOPS_OPTS | \
$PREFILTER \
| ($GS $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS \
    -sOutputFile="|cat 1>&3" $GAMMAFILE -_ >/dev/null) 3>&1 \
| foo2xqx -r$RES -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \
            $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG $SAVETONER -T$DENSITY \
            -J "$LPJOB" -U "$USER" \
            $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD -D$DEBUG

That's where all the transformations from [text|postscript|image] to printer code happens.
Add this line just above that block:

ps2ps <(cat) >(cat) | \

ps2ps does not work with pipes, only with command arguments, so I use bash process substitution as a workaround.

Here is the patch :

--- /usr/bin/foo2xqx-wrapper
+++ /usr/bin/foo2xqx-wrapper
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 #* Copyright (C) 2003-2006  Rick Richardson
 #*
@@ -650,6 +650,7 @@
 #
 GS="$GSBIN -q -dBATCH -dSAFER -dQUIET -dNOPAUSE"
 
+ps2ps <(cat) >(cat) | \
 foo2zjs-pstops $PSTOPS_OPTS | \
 $PREFILTER \
 | ($GS $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS \

I am not competent enough to evaluate how clever or sketchy this patch is, but it works and I think it's safe smile

Offline

#7 2010-12-04 10:06:45

piie
Member
Registered: 2007-02-20
Posts: 33

Re: cups printing font issue. Laserjet P1005 [SOLVED]

That did it, it's working again smile
Great work mate, really!

.oO(and I've to buy a new toner)

Offline

#8 2010-12-04 17:45:21

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: cups printing font issue. Laserjet P1005 [SOLVED]

Oh, I buy my toner refills on eBay such as this :
http://cgi.ebay.ca/1-TONER-REFILL-HP-P1 … 0704178801

I drilled a 1/2" hole in the cartridge, filled it up, used electric tape to block the hole. It's so cheap and easy! Buying a new cartridge doesn't make sense, that's my advice.

Offline

#9 2010-12-04 20:36:58

piie
Member
Registered: 2007-02-20
Posts: 33

Re: cups printing font issue. Laserjet P1005 [SOLVED]

heh, thanks, will try this too.

Offline

Board footer

Powered by FluxBB