Closed Bug 399388 Opened 17 years ago Closed 17 years ago

printout from black laserjet printer is not gray scaled

Categories

(Core :: Printing: Output, defect, P2)

x86
Windows XP
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: fullmetaljacket.xp+bugmail, Assigned: vlad)

References

()

Details

(Keywords: regression, testcase)

Attachments

(2 files)

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a9pre) Gecko/2007101016 Minefield/3.0a9pre ID:2007101016

print out from my hp laserjet 1200 printer is not properly gray scaled. 

im sure this just regressed recently (maybe few weeks ago), i will try track down the specific regression.
Flags: blocking1.9?
Summary: printout from blank laserjet printer is not gray scaled → printout from black laserjet printer is not gray scaled
vlad: this sounds like the cairo printing rewrite.  thoughts?
Assignee: nobody → vladimir
I can reproduce this problem with

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a9pre) Gecko/2007110103 Minefield/3.0a9pre

when printing to a HP LaserJet 4050 with PCL Driver.

Printing with the PS driver does not cause the problem. Also printing with PCL to an HP C6180 inkjet with the driver set to print grayscale does not cause the problem.

The problem is that all images are printed in black and white instead of gray scaled.

However I am unable to reproduce this with using cairo and some simple test code that prints an image.
Flags: blocking1.9? → blocking1.9+
Priority: -- → P3
nominating for --> BETA4

Target Milestone: --- → mozilla1.9beta4
-fullmetaljacket- please don't set milestone targets, it's not your call.
Target Milestone: mozilla1.9beta4 → ---
I tested this with an OKIPage 14EX Laserprinter and a Brother HL-2030 Laserprinter (because I first thought this was a bug with my printer).

It doesn't happen when printing it to a pdf file.
(In reply to comment #8)
> I tested this with an OKIPage 14EX Laserprinter and a Brother HL-2030
> Laserprinter (because I first thought this was a bug with my printer).
> 
> It doesn't happen when printing it to a pdf file.

Wait, were you printing from Linux or from Windows?  The OS of the bug I marked as a dup was windows vista, is that still correct?
Yes, I tried form windows Vista, that's correct.
Printing from  Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b4pre) Gecko/2008021204 Minefield/3.0b4pre to a Canon iP4300 printer, I do see a difference in the greyscale areas comparing to printing from Mac OS X 10.5 to an Epson Printer (greyscale areas are lighter on the Win Vista printed version). I tested by going to http://maps.google.com/ and printing the map of Kansas City. I have the printed output available in my cube for review.
Marcia, the bug here is about printing from windows and the resulting image output being black and white only (i.e. no shades of gray).  Are you seeing any black and white-only results from Vista?
Keywords: testcase
Attached image output comparison
This is a comparison of trunk and branch print output on paper. I made pictures of both with my digital camera.
Trunk output is on the left, branch output on the right.
Priority: P3 → P2
I have the same issue; printout are in black and white with no greyscale.
Other programs (including the test print) print correctly, it's just firefox.

Windows XP SP2
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b3) Gecko/2008020514 Firefox/3.0b3
HP LaserJet 4000 Series PCL Printer using built-in XP drivers.

Adrian Johnson: thanks for the PS driver suggestion, this is a good work around for now.
Flags: wanted1.9.0.x+
Flags: tracking1.9+
Flags: blocking1.9-
Sorry, but this bug has to be fixed before Firefox 3 comes out.
Otherwise, it would mean you couldnt use Firefox to print out routes/maps or anything with images, afaict.
Let me know if you need help with testing patches, finding out which part of the code is causing the isuee, etc.
Flags: blocking1.9- → blocking1.9?
+'ing w/ P2 based on Comment #15.  Vlad please adjust if you disagree.
Flags: blocking1.9? → blocking1.9+
Flags: wanted1.9.0.x+
Also, Pav had marked this as wanted1.9.0.x+.  Pav, please speak up if you still feel the same.  Don't mean to step on your toes here.
I already minus'd this once for 1.9; I will happily fix it if I can reproduce it, but I have not been able to on any of the printers I have access to, whether at office or at home.  Martijn, I agree that it's a bad issue, but noone here has been unable to reproduce which makes it hard to fix.  The code is pretty generic there, there isn't anything that does anything special with colors or with black & white.

So, I'm going to put it back on the wanted list; it would be great if QA could step in and do some work here to get this reproduced (including buying a printer and/or testing other printer drivers) so we can get it fixed for 1.9.
Flags: wanted1.9.0.x+
Flags: blocking1.9-
Flags: blocking1.9+
This can be reproduced without a printer by installing a PCL viewer. Google for "PCL viewer".

I used the "HP LaserJet 4050 Series PCL" driver and printed to a file. The comments seem to indicate the the problem occurs with HP LaserJet printers and PCL drivers.
Hi Adrian, thanks for your suggestion. Unfortunately, I'm not able to reproduce it with your comments.

I downloaded this PCL Reader:
http://www.bestfreewaredownload.com/freeware/t-free-pclreader-freeware-dnntdaxl.html

I downloaded the "HP LaserJet 4050 Series PCL" driver from here.
http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareIndex.jsp?lang=en&cc=us&prodNameId=18322&prodTypeId=18972&prodSeriesId=25475&swLang=8&taskId=135&swEnvOID=228

After installing all that stuff, I compared the print output between trunk and branch, but they both look the same.
I went through the Windows XP add printer wizard and selected the HP LaserJet 4050 Series PCL driver from there. Maybe this bug depends on a specific version of the printer driver. The driver on the hp.com website may not be the same as the version included with WinXP.
Flags: blocking1.9-
Yes! I finally can reproduce it with the included windowsXP driver named "HP LaserJet 4050 Series PCL".

Adrian, thank you so much for this!
Ah, ok!  Now I can reproduce it.  I'll take a look over the weekend.
My guess from looking at the output here is that we need to set StretchBltMode to HALFTONE, and use StretchDIBits/StretchDIBBlt to let windows dither for us.  It looks like in most cases the printer drivers know how to dither, but not for some.
So we are setting HALFTONE correctly it looks like.

Looking at the PCL, there is no @PJL SET RENDERMODE=GRAYSCALE being sent, but adding that in doesn't change anything.  I'm guessing that the raw image bits in the PCL are already damaged, so it's something above that's doing it.
Attached patch patchSplinter Review
So the problem that was happening is this:

- printing a RGB24 image
- the printer is a 1bpp printer
- we call call pattern_acquire_surface
  - which in turn calls win32_surface_clone_similar
  - which was seeing that alpha wasn't needed and that we had a DDB in the original (RGB24)
  - and was calling CreateCompatibleDC on the printer DC... thus ending up with a 1bpp DC, and then compositing into it without HALFTONE or anything.
- we then print the already-damaged image to the printer. oops.

This patch makes us always clone to DIBs when we're asked to create something for a printing surface backend.  Adrian, what do you think?  I'm guessing you may not have seen this in local testing because the image you were printing wasn't stored as a RGB24 DDB.
Attachment #308511 - Flags: review?(ajohnson)
Looks fine to me.

All my testing when I wrote win32_printing was with cairo_image_surface images. So I had never exercised the clone_similar code path.
Comment on attachment 308511 [details] [diff] [review]
patch

(marking adrian's review -- adrian, I just gave you privs to edit bugs/flag attachments, thought you already had that... sorry about that!)
Attachment #308511 - Flags: review?(ajohnson) → review+
Should be fixed in tomorrow's nightly, please verify?
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
fixed indeed. thanks!

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b5pre) Gecko/2008031614 Minefield/3.0b5pre ID:2008031614
Status: RESOLVED → VERIFIED
Flags: wanted1.9.0.x+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: