Bug 689479

Summary: pxlcolor device output not correct
Product: Ghostscript Reporter: George Liu <george.liu>
Component: Printer DriverAssignee: Marcos H. Woehrmann <marcos.woehrmann>
Status: NOTIFIED FIXED    
Severity: normal CC: htl10
Priority: P4    
Version: 8.15   
Hardware: Macintosh   
OS: MacOS X   
Customer: Word Size: ---
Attachments: this file will generate invalid pxl file.
The pcl-xl file generated by the attached postscript file
patch

Description George Liu 2007-09-27 15:57:01 UTC
Ghostscript cannot consume Postscript file generated by Safari browser (tested
on both Safari 1.3 and 3.0 beta)

Print www.google.com, www.yahoo.com, as well as other pages, using pxlmono
driver. Printer always print a blank page. 

I could  print  web page  as Black&White  by Safari .
The captured pcl-xl data shows:

Colorspace Command :   eGray
ImageData:SourceWidth(uint16, 3886), dataLength(11660, "")

eGray means  1 byte / 1 pixel  .
If SouceWidth is 3886,  dataLength should be 3886 . (=3386x1byte/1pixel)
But dataLength is 11660. (= 3886 x 3 ( 3byte /1pixel))
This dataLength means RGB .

Same web page can be printed to pxlmono driver by Firefox.
Comment 1 George Liu 2007-09-27 16:10:17 UTC
Created attachment 3418 [details]
this file will generate invalid pxl file.
Comment 2 Hin-Tak Leung 2007-10-02 11:49:10 UTC
Hmm, sometime ago, pxlmono/pxlcolor used to differ only by a PJL wrapper switching
the color mode at the PJL level.
Comment 3 George Liu 2007-10-02 12:01:10 UTC
Bug #688320 demonstrates the same problem. Maybe these two bugs has the same
root cause.
--------------------------------------------------------
The pxlcolor driver sometimes outputs unusable output of images. The output is
"ExtraData" by HP printer and also by GhostPCL. A look into the PCL6 stream
finds that the ReadImage operator is fed with extra data, e.g., the page
colorspace is eGray, the image is e8Bit and 8x1 pixels large, but the ReadImage
is fed with 24 bytes instead of 8 bytes.
--------------------------------------------------------
Comment 4 George Liu 2007-10-11 09:35:56 UTC
I modified the generated PCL-XL data, replaced c0 01 f8 03 6a (set
colorspace=eGray) with c0 02 f8 03 6a (set colorspace=eRGB). It still cannot print.
Comment 5 Marcos H. Woehrmann 2007-10-11 11:12:28 UTC
I'm having trouble duplicating this bug.

Ghostscript 8.15 generates an error when converting the attached:  /invalidfont in --xshow--

More recent versions of Ghostscript read the input file but generate PCL-XL output which prints fine on 
both my HP LaserJet 6MP and my LaserJet 4500.
Comment 6 George Liu 2007-10-11 12:03:14 UTC
Created attachment 3466 [details]
The pcl-xl file generated by the attached postscript file 

The pcl-xl file generated by the attached postscript file using command line

cat ~/Download/attachment.cgi | gs -q -dBATCH -dPARANOIDSAFER -dNOPAUSE
-sDEVICE=pxlcolor -r600x300 -sPAPERSIZE=letter -sOutputFile=- - > junk.pxl
Comment 7 George Liu 2007-10-11 12:43:11 UTC
I installed GS 8.60 and did the same test (submit the attached Postscript).
Printer will not print. still see colorspace set to eGrey.

> More recent versions of Ghostscript read the input file but generate PCL-XL
output which prints fine on both my HP LaserJet 6MP and my LaserJet 4500.

What version of Ghostscript is it?
Comment 8 Marcos H. Woehrmann 2007-10-11 14:24:07 UTC
Sorry, but I'm confused.  The title of the bug and your original comment refers to pxlmono, but you've 
attached a PCL-XL file written using pxlcolor.  Which device are you having trouble with?
Comment 9 George Liu 2007-10-11 14:27:19 UTC
Sorry, I have trouble with pxlcolor. pxlmono works fine. (I thought pxlmono ==
pxlcolor)
Comment 10 Marcos H. Woehrmann 2007-10-11 18:12:31 UTC
okay, now I can reproduce the problem.

With pxlcolor and gs860 my HP 6MP prints InternalError 0x26 and the HP 4500
prints ExtraData.

I'll investigate further.
Comment 11 Marcos H. Woehrmann 2007-10-14 22:35:19 UTC
This problem is caused by the pxl output stream being in the wrong colorspace
when the image data appears.  Inserting an

  ubyte eRGB ColorSpace
  SetColorSpace

before the BeginImage operator at position 3501 allows this file to be printed
on my HP 4500 and HP 6MP and also allows GhostPCL 1.50 to read the file.

I'm in the process of fixing gdevpx.c and expect to have a patch soon.
Comment 12 Marcos H. Woehrmann 2007-10-14 23:44:56 UTC
Created attachment 3471 [details]
patch
Comment 13 Marcos H. Woehrmann 2007-10-14 23:45:29 UTC
Fixed in r8290 (see attached patch).
Comment 14 George Liu 2007-10-15 11:18:59 UTC
I downloaded the latest Ghostscript svn. build 8291. (The change in patch
appeared in source code)
I compiled gs from source and gs -h showed pre-8.61 release.(Aug-02)

Print to HP 5500 and got the following error:

PCL XL error
    Subsystem: IMAGE
    Error:     ExtraData
    Operator:  ReadImage
    Position:  3506
Comment 15 Marcos H. Woehrmann 2007-10-15 17:33:18 UTC
I've tested the output on an HP 4100, 4500, and 6MP and using GhostPCL, all work with the latest 
pxlcolor device.  Can you attach the pxl file?
Comment 16 Marcos H. Woehrmann 2007-10-16 07:28:51 UTC
A minor correction: pxlcolor output does not print on my HP LaserJet 6MP,
generating an InternalError 0x26 at position 417.  I believe this is because the
6MP is a monochrome device and can't handle color PCL-XL images.
Comment 17 George Liu 2007-10-16 10:07:44 UTC
I think my problem (HP5500 won't print) might be a driver rather than
Ghostscript problem. I can use ghostscript command line and generate a valid
PCL-XL data that can print on HP5050N. 

This issue can now be closed as fixed. Thank you.