Bug 692750 - No color (only gray scale) on printed output
Summary: No color (only gray scale) on printed output
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Color (show other bugs)
Version: 9.04
Hardware: PC Windows 7
: P4 normal
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-18 23:35 UTC by Crandall
Modified: 2016-12-03 07:08 UTC (History)
4 users (show)

See Also:
Customer:
Word Size: ---


Attachments
have gdevwpr2 "manage" its device icc profiles (8.15 KB, patch)
2012-08-09 11:11 UTC, Chris Liddell (chrisl)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Crandall 2011-12-18 23:35:21 UTC
OVERVIEW: 

My goal is color printout from emacs 23.3, on Windows 7 64x,
with an HP printer (Officejet Pro 8600 Plus). 

I successfully configured fonts and apparently color output 
with ps-print.el, which calls gswin32c.exe, or gswin64c.exe.
(I've tried both.)

Unfortunately, all pages sent from emacs to the printer
reproduce colors with shades of gray (no color at all).

This also happens if I create an intermediate postscript 
file (the code of which shows correct color information),
and send that to the printer with 

> gswin32c -dSAFER -sDEVICE=mswinpr2 doMorning.org.ps

However, the command, /gs9.04/lib/ps2pdf, run on that 
same .ps file, creates a PDF that shows full color and 
prints with full color. 


In summary, the problem seems to be trapped between 
ps2pdf, which works, and gswin32c, which does not 
(as gswin64c does not).


STEPS TO REPRODUCE: 

1. In emacs buffer of "myTestFile" (with colored faces)
   C-u M-x ps-print-buffer-with-faces
   this creates myTestFile.ps

2. Open that file, verify fonts have FG color triplets:

------------------------------
0 BeginPage
/f0 F
false BG
0.000 0.000 0.000 FG
0.698 0.133 0.133 FG      << RGB: orange/red
(#+FILETAGS: SCRIPT) S
LHL
0.000 0.000 1.000 FG	  << RGB: solid blue
(* Morning Startup) S
0.000 0.000 0.000 FG
------------------------------

3. Send to printer with  
   > gswin32c -dSAFER -sDEVICE=mswinpr2 myTestFile.ps


ACTUAL RESULTS: 

Fonts are correct, but color is replaced with grays.


EXPECTED RESULTS:

Color fonts on screen are printed with correct colors. 


BUILD DATE & PLATFORM: 

Windows executables downloaded from
http://www.ghostscript.com/download/gsdnld.html

Both 32 and 64 bit versions, which unpack to give
     /gs9.04/bin/gswin64c.exe      and
     /gs9.04/bin/gswin32c.exe

OS: Windows 7 Enterprise, 64 bit, Service Pack 1
    CurrentBuild: 7601


ADDITIONAL INFORMATION: 

Please let me know if you have additional tests
that I can run to ferret out this problem. Thanks.
Comment 1 Michael Vrhel 2011-12-20 02:43:53 UTC
If you can get the issue to appear with one of our raster image output devices that would help me in figuring this out.
Comment 2 Hin-Tak Leung 2011-12-20 12:33:09 UTC
AFAIK the mswinpr2 device uses your default printer settings, so you must set up your default printer to *print in color by default*. Have you set up your printer to print in ink-saving draft b/w mode by default?
Comment 3 Jaime Machado 2012-04-23 12:26:16 UTC
Im also facing a similar problem.

I tried printing color pdf with but it only came out in gray scale.

The pdf that i tried to print was the text_graphic_image.pdf that comes in the example folder.

I used the command: gswin64c -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=1 -sDEVICE=mswinpr2 text_graphic_image.pdf
and tried to print 3 diferent printers (Windows XPS and two other in my network). All of then only came out in gray scale.

if i run the command gswin64c text_graphic_image.pdf the pdf is rendered perfectly.

Is there anything else that i can help with to "fix" this issue?
Comment 4 jeick 2012-07-31 16:36:45 UTC
This bug also affects 9.05. Last confirmed working version is 8.63. Any news on this issue, there appears to be more than a few reported bugs. Is there a specific command that needs to be given from the command line to print to color that I am missing??
Comment 5 Chris Liddell (chrisl) 2012-08-01 14:41:44 UTC
The problem is a result of the switch to an all (within reason) ICC based color workflow in GS 9.xx. The mswinpr2 device is, for some reason, not getting an ICC profile associated with it.

My suspicion is that the root cause is that mswinpr2 is one of the few devices that doesn't have an inherent color model, and it hasn't been updated to setup it's own device ICC profile.

As workaround, you can give Ghostscript a specific profile to use for the output device on the command line, thus:

-sOutputICCProfile=default_cmyk.icc

Your easiest options are the "build-in" profiles:
default_cmyk.icc
default_rgb.icc
ps_cmyk.icc
ps_rgb.icc
srgb.icc

(there are also a few other built-in profiles, but those above are the ones most likely to be of use).

You'll probably have to try all the above to find one that works best with your printer.

I tested this on 9.05.

Please let us know the results.......
Comment 6 Crandall 2012-08-03 03:14:11 UTC
Oh what a difference 34 characters can make!

I've been living with gray output (or working around with
macros to create a .ps and then a .pdf, which is in color),
but now, with 34 new characters in my emacs init, COLOR!

What worked for me: "-sOutputICCProfile=default_cmyk.icc"

Emacs init.el:

;; Ghostscript 9.05 64 bit
(setenv
 "GS_LIB"
 "g:/dev/bin/ghostscript/gs9.05/lib; g:/dev/bin/ghostscript/gs9.05/fonts")

(setq ps-lpr-command "g:/dev/bin/ghostscript/gs9.05/bin/gswin64c.exe")

(setq ps-lpr-switches '("-q"
                        "-Ig:/Windows/Fonts"
                        "-dNOPAUSE"
                        "-dBATCH"
                        "-sDEVICE=mswinpr2"
                        "-sOutputICCProfile=default_cmyk.icc"))


Thanks for the suggestions, Chris!

-BC


> As workaround, you can give Ghostscript a specific profile to use for the
> output device on the command line, thus:
> 
> -sOutputICCProfile=default_cmyk.icc
> 
> Your easiest options are the "build-in" profiles:
> default_cmyk.icc
> default_rgb.icc
> ps_cmyk.icc
> ps_rgb.icc
> srgb.icc
>
Comment 7 Chris Liddell (chrisl) 2012-08-09 11:11:14 UTC
Created attachment 8844 [details]
have gdevwpr2 "manage" its device icc profiles

Okay, here's a patch which revises the gdevwpr2.c device to "manage" the device ICC profiles, selecting what I *think* are appropriate profiles (based on the color model selected by the existing code).

This works with a couple of pretty trivial tests, on the one "printer" have available on my Win7 machine (the XPS virtual printer), but could do with a bit more testing.

If anyone above is in a position to patch and build Ghostscript, it would be great if you could test it. If the worst comes to the worst, I can do a test build for people to try.
Comment 8 Chris Liddell (chrisl) 2012-08-09 11:13:25 UTC
Oh, if you are going to test it, you'll want to test it without the "-sOutputICCProfile=default_cmyk.icc" workaround outlined above.

And I might as well grab ownership of the bug....
Comment 9 Crandall 2012-08-10 07:14:06 UTC
Hi Chris,

If you make it, I'd be happy to test it!

Or, does the new gs906w64.exe include your patch?

-BC


(In reply to comment #8)
> If anyone above is in a position to patch and build Ghostscript, 
> it would be great if you could test it. If the worst comes to the worst, 
> I can do a test build for people to try.
Comment 10 Chris Liddell (chrisl) 2012-08-10 07:30:26 UTC
Hi BC,

No 9.06 doesn't have that change in it. TBH, I only started poking at this problem while I waiting on some of the automated parts of the release process to complete.

I'll build a test installer, and put it somewhere for you to download.
Comment 11 Chris Liddell (chrisl) 2012-08-10 07:59:46 UTC
Here are the two windows installers which include my proposed change:

http://www.ghostscript.com/~chrisl/gs907w32-Bug692750.exe

http://www.ghostscript.com/~chrisl/gs907w64-Bug692750.exe


Any feedback appreciated.

Chris
Comment 12 Crandall 2012-08-16 04:29:21 UTC
Hi Chris,

I ran into an error testing the 64 bit version. 

My guess is that this is because it is not a 
"Windows command line program", like gswin64c.EXE, 
but is instead similar to gswin64.EXE:

http://ghostscript.com/doc/current/Install.htm#General_Windows


As I wrote last time, this is what works for me now, with:

GNU Emacs 24.1.50.1 
  (i386-mingw-nt6.1.7601) 
   of 2012-07-22 on MARVIN

(setenv
 "GS_LIB"
 "g:/dev/bin/ghostscript/gs9.05/lib; g:/dev/bin/ghostscript/gs9.05/fonts")
(setq ps-lpr-command "g:/dev/bin/ghostscript/gs9.05/bin/gswin64c.exe")
(setq ps-lpr-switches '("-q"
                        "-Ig:/Windows/Fonts"
                        "-dNOPAUSE"
                        "-dBATCH"
                        "-sDEVICE=mswinpr2"
                        "-sOutputICCProfile=default_cmyk.icc"))


I grabbed your gs907w64-Bug692750.exe, then changed 
my init.el in two places, the ps-lpr-command and took out 
the new cmyk.icc switch:

(setenv
 "GS_LIB"
 "g:/dev/bin/ghostscript/gs9.05/lib; g:/dev/bin/ghostscript/gs9.05/fonts")
(setq ps-lpr-command "g:/dev/bin/ghostscript/gs9.05/bin/gs907w64-Bug692750.exe")
(setq ps-lpr-switches '("-q"
                        "-Ig:/Windows/Fonts"
                        "-dNOPAUSE"
                        "-dBATCH"
                        "-sDEVICE=mswinpr2"))


On reboot, trying to print part of a page, the debugger came up:

  debug(error (file-error "Spawning child process" "exec format error"))

  call-process("g:/dev/bin/ghostscript/gs9.05/bin/gs907w64-Bug692750.exe"
nil (#<buffer  *print-region-helper*> t) nil "-q" "-Ig:/Windows/Fonts"
"-dNOPAUSE" "-dBATCH" "-sDEVICE=mswinpr2"
"g:\\dev\\bin\\emacs\\.emacs.d\\tmp\\EP4452-pm")

  apply(call-process
"g:/dev/bin/ghostscript/gs9.05/bin/gs907w64-Bug692750.exe" nil
(#<buffer  *print-region-helper*> t) nil ("-q" "-Ig:/Windows/Fonts"
"-dNOPAUSE" "-dBATCH" "-sDEVICE=mswinpr2"
"g:\\dev\\bin\\emacs\\.emacs.d\\tmp\\EP4452-pm"))

  direct-print-region-helper("USB001" 1 35953
"g:/dev/bin/ghostscript/gs9.05/bin/gs907w64-Bug692750.exe" nil 0 nil
("-q" "-Ig:/Windows/Fonts" "-dNOPAUSE" "-dBATCH" "-sDEVICE=mswinpr2"))

  direct-ps-print-region-function(1 35953
"g:/dev/bin/ghostscript/gs9.05/bin/gs907w64-Bug692750.exe" nil 0 nil
"-q" "-Ig:/Windows/Fonts" "-dNOPAUSE" "-dBATCH" "-sDEVICE=mswinpr2")

  apply(direct-ps-print-region-function 1 35953
"g:/dev/bin/ghostscript/gs9.05/bin/gs907w64-Bug692750.exe" nil 0 nil
("-q" "-Ig:/Windows/Fonts" "-dNOPAUSE" "-dBATCH" "-sDEVICE=mswinpr2"))

  ps-do-despool(nil)
  ps-print-with-faces(1 476 nil t)
  ps-print-region-with-faces(1 476 nil)

  call-interactively(ps-print-region-with-faces nil nil)


Let me know if you have another version to test.

Thanks again,

-BC



(In reply to comment #11)
> Here are the two windows installers which include my proposed change:
> 
> http://www.ghostscript.com/~chrisl/gs907w32-Bug692750.exe
> 
> http://www.ghostscript.com/~chrisl/gs907w64-Bug692750.exe
Comment 13 Chris Liddell (chrisl) 2012-08-16 06:38:03 UTC
Crandall,

gs907w??-Bug692750.exe are installers, not "bare" executables.

Chris
Comment 14 Chris Liddell (chrisl) 2012-08-17 09:18:40 UTC
I've committed this change:

http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=fe79c76c

I didn't want to risk it going missing, or other problems arising.

If testing reveals it not working correctly, please reopen.
Comment 15 20asd 2016-12-02 23:16:09 UTC
Hi Chris,

Where could I download a copy of your 2 updated installers ?

Thanks.
Comment 16 Ken Sharp 2016-12-03 04:08:54 UTC
(In reply to 20asd from comment #15)
> Hi Chris,
> 
> Where could I download a copy of your 2 updated installers ?
> 
> Thanks.

As Chris said in comment #14, the change was comiitted more than 4 years ago. Current releases all have it.
Comment 17 20asd 2016-12-03 06:35:21 UTC
I am using v 9.20, but is experiencing the same issue , that is :

the printed output is in grayscale even though the pdf is in color.

My printer default setting is to color as well .

What am I missing ?

Regards.
Comment 18 Ken Sharp 2016-12-03 06:45:28 UTC
(In reply to 20asd from comment #17)
> I am using v 9.20, but is experiencing the same issue

Yes, and you have already opened a bug report to that effect. Please don't add random 'me too' comments to old closed problem reports, just because the description looks the same.

The fact that this bug has remained closed for 4 years should serve as some evidence that the mswinpr2 device will print in colour, when your (Windows) system is correctly configured.


> the printed output is in grayscale even though the pdf is in color.
> 
> My printer default setting is to color as well .
> 
> What am I missing ?

Right at the moment, I cannot tell. I will try your file with the nearest equivalent printer I have available, when I'm back at my desk. In the meantime, please note that the AGPL version of Ghostscript is supplied 'as is' without either warranty or support.
Comment 19 20asd 2016-12-03 07:08:27 UTC
Understood. Thanks.