Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #3152 > unrolled thread

100% black, as required by a book printer

Started byjdaw1 <jdawiseman@gmail.com>
First post2017-07-30 05:42 -0700
Last post2017-11-16 15:57 -0800
Articles 13 — 5 participants

Back to article view | Back to comp.lang.postscript


Contents

  100% black, as required by a book printer jdaw1 <jdawiseman@gmail.com> - 2017-07-30 05:42 -0700
    Re: 100% black, as required by a book printer Martin Leese <please@see.Web.for.e-mail.INVALID> - 2017-07-30 08:24 -0600
      Re: 100% black, as required by a book printer jdaw1 <jdawiseman@gmail.com> - 2017-07-30 12:31 -0700
        Re: 100% black, as required by a book printer luser droog <luser.droog@gmail.com> - 2017-07-30 15:47 -0700
    Re: 100% black, as required by a book printer Carlos <carlos@cvkm.cz> - 2017-07-30 19:37 +0200
    Re: 100% black, as required by a book printer ken <ken@spamcop.net> - 2017-07-31 08:58 +0100
      Re: 100% black, as required by a book printer jdaw1 <jdawiseman@gmail.com> - 2017-07-31 14:37 -0700
        Re: 100% black, as required by a book printer jdaw1 <jdawiseman@gmail.com> - 2017-08-02 12:15 -0700
          Re: 100% black, as required by a book printer jdaw1 <jdawiseman@gmail.com> - 2017-08-29 15:15 -0700
            Re: 100% black, as required by a book printer jdaw1 <jdawiseman@gmail.com> - 2017-08-31 09:36 -0700
              Re: 100% black, as required by a book printer jdaw1 <jdawiseman@gmail.com> - 2017-11-13 14:16 -0800
                Re: 100% black, as required by a book printer jdaw1 <jdawiseman@gmail.com> - 2017-11-14 15:02 -0800
                  Re: 100% black, as required by a book printer jdaw1 <jdawiseman@gmail.com> - 2017-11-16 15:57 -0800

#3152 — 100% black, as required by a book printer

Fromjdaw1 <jdawiseman@gmail.com>
Date2017-07-30 05:42 -0700
Subject100% black, as required by a book printer
Message-ID<5f377985-8e00-4f6c-aa8b-bfd4d7a2874a@googlegroups.com>
Sending a book to be printed. Because of an unwise decision ages ago it’s in Microsoft Word. (Moving 207 bookmarks, 3k index entries, and 700 pictures to a different program would introduce too many errors.)

A candidate printer has written: 
> the text in your file is made up of percentages of CMYK and should be 100% black

I had been printing to PostScript and distilling with Adobe Distiller XI. 

I’m willing to semi-manually change the PostScript (perhaps replace all “0 0 0 setcolor” with something else). I’m willing to distill with Adobe, or GhostScript (the latest version of which I’ll probably have to compile myself) using any recommended settings.

Fine peeps of the PostScript forum: please, can this be rescued at or near the PostScript level?

[toc] | [next] | [standalone]


#3153

FromMartin Leese <please@see.Web.for.e-mail.INVALID>
Date2017-07-30 08:24 -0600
Message-ID<olkpv6$jv2$1@dont-email.me>
In reply to#3152
jdaw1 wrote:
> Sending a book to be printed. Because of an unwise decision ages ago it’s in Microsoft Word. (Moving 207 bookmarks, 3k index entries, and 700 pictures to a different program would introduce too many errors.)
> 
> A candidate printer has written: 
>> the text in your file is made up of percentages of CMYK and should be 100% black
> 
> I had been printing to PostScript and distilling with Adobe Distiller XI. 
> 
> I’m willing to semi-manually change the PostScript (perhaps replace all “0 0 0 setcolor” with something else). I’m willing to distill with Adobe, or GhostScript (the latest version of which I’ll probably have to compile myself) using any recommended settings.
> 
> Fine peeps of the PostScript forum: please, can this be rescued at or near the PostScript level?

Need to see an example file.  Could you copy
a page or two to a new Word file, pass it
through the same process you are currently
using, and stick the resulting PS file on a
Web site somewhere?

-- 
Regards,
Martin Leese
E-mail: please@see.Web.for.e-mail.INVALID
Web: http://members.tripod.com/martin_leese/

[toc] | [prev] | [next] | [standalone]


#3155

Fromjdaw1 <jdawiseman@gmail.com>
Date2017-07-30 12:31 -0700
Message-ID<321e150f-1ee7-40d1-9ed2-dd476e4b8726@googlegroups.com>
In reply to#3153
Thank you. 
http://www.jdawiseman.com/2017/20170730_PortVintages_SW1865.ps
I’ll remove it from my website in a week or so. 

From which one can see two colours of text.

[toc] | [prev] | [next] | [standalone]


#3156

Fromluser droog <luser.droog@gmail.com>
Date2017-07-30 15:47 -0700
Message-ID<1d76a8cb-049a-4d6e-8400-958d5e26c2b3@googlegroups.com>
In reply to#3155
On Sunday, July 30, 2017 at 2:31:42 PM UTC-5, jdaw1 wrote:
> Thank you. 
> http://www.jdawiseman.com/2017/20170730_PortVintages_SW1865.ps
> I’ll remove it from my website in a week or so. 
> 
> From which one can see two colours of text.

Aside from the stuff with calculated colors, the only calls 
I see to 'sc' (defined as 'setcolor') have 3 components. 
Either 0 0 0 or 1 0 0. So this doesn't appear to me to
exhibit the problem described. Unless the problem is in
the shading stuff which is doing its own colors.

[toc] | [prev] | [next] | [standalone]


#3154

FromCarlos <carlos@cvkm.cz>
Date2017-07-30 19:37 +0200
Message-ID<20170730193708.23cbee37@samara.DOMA>
In reply to#3152
[jdaw1 <jdawiseman@gmail.com>, 2017-07-30 05:42]
> Sending a book to be printed. Because of an unwise decision ages ago it’s in
> Microsoft Word. (Moving 207 bookmarks, 3k index entries, and 700 pictures to
> a different program would introduce too many errors.)
> 
> A candidate printer has written: 
> > the text in your file is made up of percentages of CMYK and should be 100%
> > black  
> 
> I had been printing to PostScript and distilling with Adobe Distiller XI. 
> 
> I’m willing to semi-manually change the PostScript (perhaps replace all “0 0
> 0 setcolor” with something else). I’m willing to distill with Adobe, or
> GhostScript (the latest version of which I’ll probably have to compile
> myself) using any recommended settings.
> 
> Fine peeps of the PostScript forum: please, can this be rescued at or near
> the PostScript level?

If the text is only black, you can try redefining, in the document's preamble,
all show* operators so that they set the color first. Something like

/show { 0 0 0 1 setcmykcolor systemdict /show get exec } def

etc...
-- 

[toc] | [prev] | [next] | [standalone]


#3157

Fromken <ken@spamcop.net>
Date2017-07-31 08:58 +0100
Message-ID<MPG.33e8f36a28660f0998991c@usenet.plus.net>
In reply to#3152
In article <5f377985-8e00-4f6c-aa8b-bfd4d7a2874a@googlegroups.com>, 
jdawiseman@gmail.com says...
> 
> Sending a book to be printed. Because of an unwise decision ages ago it?s in Microsoft Word. (Moving 207 bookmarks, 3k index entries, and 700 pictures to a different program would introduce too many errors.)
> 
> A candidate printer has written: 
> > the text in your file is made up of percentages of CMYK and should be 100% black

This is, I'm afraid, a consequence of uusing Microsoft Word to create a 
document. Microsoft has never understood colour and the fact that RGB is 
not the only possible colour space, so Microsoft products pretty much  
always create output in RGB. Even Publisher.....

In any event, your printer is both wrong, and right.

In fact the one and only colour space in your file is a CIEBased colour 
space; this is interesting in itself, I had no idea it was even possible 
to produce PostScript from Word using a CIEBased colour space.

However, I note that you are using a Macintosh. I suspect that what is 
actually happening is that Word is writing all its output in RGB, and 
MacOS is converting that RGB internally into a CIEBased colour space 
using the ICC profile for your monitor. The CIE space is not one of the 
standards and uses lookup tables for the MatrixABC which tends to 
confirm this theory.

So your printer is incorrect; the text is not made up of percentages of 
CMYK, its all made up of percentages of CIEBased colour derived from an 
ICC profile. However, you can't print CIE colours, so either their RIP 
(or possibly your PDF creator if you are supplying them with a PDF) has 
to convert the CIEBased colours into something the printer can handle. 

In a properly colour managed workflow that would mean that your text 
would end up as pure K, but in the sort of ad-hoc workflow here, what 
you actually get is something 'almost but mot quite entirely unlike' 
black.

Which is where your printer is correct, the end result *is* that your 
black text ends up being drawn in a 'rich black' which is not a pure K 
colour but composed of a number of CMYK components.


> I?m willing to semi-manually change the PostScript (perhaps replace
> all ?0 0 0 setcolor? with something else). I?m willing to distill with
> Adobe, or GhostScript (the latest version of which I?ll probably have
> to compile myself) using any recommended settings.
> 
> Fine peeps of the PostScript forum: please, can this be rescued at or near the PostScript level?

Well yes, possibly. It depends how asccurate your printer needs you to 
be about this and your precise requirements; do they actually need all 
colours in CMYK or can they live with RGB ? How many colours do you 
intend to use in your document ? In this one you are using 2 colours, 
red and black, do you ever use more ?

If you need everything as CMYK, and you only ever plan to use red and 
black (or at least, a small number of discrete colours) then you could 
redefine /setcolorspace and /setcolor so that if you get a CIEBased 
colour space you simply set DeviceCMYK, and then you write a setcolor 
procedure which examines the input components, and writes the equivalent 
in CMYK tints.

There is a worked example in the Ghostscript documentation for a 
subclassing device which turns all text black, but it would need 
modification for your purposes (because your red text would turn black 
too) requires some knowledge of C programming and would also require you 
to modify the Ghostscript build environment and rebuild it. Probably too 
much work for this I imagine.

As a (very) simple experiment I created a file called cmyk.ps 
containing:

%!

/setcolor {
  2 index 0 eq 2 index 0 eq 2 index 0 eq and and {
    %pure black
    pop pop pop
    0 0 0 1 setcmykcolor  
  }{
    setrgbcolor
  }ifelse
} bind def


I then used Ghostscript to create a PDF file with this command line:

gs -sDEVICE=pdfwrite -sOutputFile=jdaw.pdf -dCompressPages=false cmyk.ps 
20170730_PortVintages_SW1865.ps

The -dCompressPages is simply so that we can view the PDF file content 
easily, you would remove that for a production file. The resulting PDF 
file contains:

0 0 0 1 k
q
8.33333 0 0 8.33333 0 0 cm BT
/R8 6 Tf
1 0 0 1 266.751 800.7 Tm
[(!)-0.200195(")0.200195(#)0.195313($)0.200195(%&')0.200195(\(\(\)%
\(*+)-0.200195(,)0.113229(&)]TJ
/R10 6.96 Tf
16.9992 -764.4 Td
[(!)-2.90022(!)-2.90022(")-2.8203(#)]TJ
ET
Q
1 0 0 rg
q
8.33333 0 0 8.33333 0 0 cm BT
/R12 9.84 Tf
1 0 0 1 36.5002 776.94 Tm
[(!)-9.02502(")-9(#)-9($)-9(%)-4(&)-11(')-15(\()-4(\))-6(*)-10(%)-4(+)-
15(,)-10(,)-10(-)-10(*)-10(,)-10(.)-10(/)-9.00194(0)-8.17721(%)-4.50023
(%)-4.49874(%)278]TJ
ET

the 'k'operator in '0 0 0 1 k' sets CMYK colour, the 'rg' operator in '1 
0 0 rg' sets RGB colour. So the resulting PDF file contains black text 
as black, and coloured text as RGB.

The odd scaling is because the PostScript file has device-specific code 
for a printer (possibly an HP printer) driven by CUPS, and sets the 
resolution to 600 dpi.

I don't think you can do this trick of two PostScript files with Acrobat 
Distiller, it creates a new outptu file for each input file, so for 
Distiller you would have to modify each PostScript file by prepending 
the content of cmyk.ps.

Please be aware that ths is a *very* crude program, it will only work 
when the input to setcolor is guaranteed to be 3 components, as your 
example file is. A more thorough program is obviously possible but would 
require significantly more programming effort.



			Ken

[toc] | [prev] | [next] | [standalone]


#3158

Fromjdaw1 <jdawiseman@gmail.com>
Date2017-07-31 14:37 -0700
Message-ID<5c9ee7ac-697d-4ea6-9b06-75d307dfdd92@googlegroups.com>
In reply to#3157
Ken,

Thank you. That is a very long reply, the detail of which will be the subject of experiments. 

To answer your questions: 
• My text comes in only two colours: red and black. 
• Many of the “700 pictures” are black-and-grey; but many are full-colour PNGs, some with edge patches of transparency. I know that the colours will print imperfectly: in most cases (e.g., pictures of pages of old cellar books) this won’t be important.

The 600dpi bothers me. Pictures, having been cropped, are of all kinds of original pixel dimensions. In the document they have scaled to be, typically, 3″ across. Your observation explains why Adobe Pro shows that there are only a few distinct picture resolutions in the PDF. Somehow I need to persuade Word to print every picture at its full maximum resolution, because two resolution changes (Word, then printer) would damage print quality. 

No trouble at all. 


Your cute little preamble can become one line, slightly shortened, and then lengthened to be robust against being multiply prefixed (oops!):

/setcolor load type /operatortype eq {/setcolor {3 copy 0 eq exch 0 eq and exch 0 eq and {1 setcmykcolor} {setrgbcolor} ifelse} bind def} if

which, with a “%!PS”, can very easily be cat’ted to the start of the PostScript. And, in my 4½GiB PostScript file, it works! (Should setrgbcolor be similarly redefined?) 

For experiment, I’ve uploaded a page with two fairly typical pictures 
http://www.jdawiseman.com/2017/20170731_PortVintages_SW1945.ps
and removed the previous file.

[toc] | [prev] | [next] | [standalone]


#3161

Fromjdaw1 <jdawiseman@gmail.com>
Date2017-08-02 12:15 -0700
Message-ID<8c591b8e-d651-432d-9593-8e9e526ecf64@googlegroups.com>
In reply to#3158
The printer, sent a sample of the new PDF, replied: 

> The sample PDF black text is 100% and contains no CM or Y, so that’s positive.

> It’s well over 20 years since I got into editing postscript files (out of necessity in those days) so Ken’s answer is very interesting and includes stuff I didn’t know. He’s clearly an expert on this, but I’d suggest that you really don’t want to dig into the postscript file because one keystroke error could give unexpected results, and anyway you shouldn’t need to. It is common to generate a PDF with a black only text channel (in the CMYK colour model) straight out of Word using the Adobe print driver.

Thank you.

[toc] | [prev] | [next] | [standalone]


#3171

Fromjdaw1 <jdawiseman@gmail.com>
Date2017-08-29 15:15 -0700
Message-ID<be0e7f3f-57f5-44d2-a82e-dbbeafa6c035@googlegroups.com>
In reply to#3161
The above worked, until more pictures were added. These came from my iPhone via GraphicConverter, and were broken by the change of colorspace. The following code seems to work well: please could somebody knowledgeable check it for obvious errors? Thank you. (After fixing any problems caused by comments overspilling the line.)


%!PS

% This version 22:50 Tue 29 Aug 2017 by Julian Wiseman of www.jdawiseman.com, based on original by 'ken'.
% Microsoft Word doesn't make proper printers' black. Print to PostScript; prepend this; distill. Fixed.
% https://groups.google.com/forum/#!topic/comp.lang.postscript/6JW6VamdVlw

/setcolor load type /operatortype eq
{
	/colorspaceJDAW currentcolorspace def

	/setcolorspace load type /operatortype eq {/setcolorspace {/colorspaceJDAW 1 index     store setcolorspace} def} if
	/setgray       load type /operatortype eq {/setgray       {/colorspaceJDAW /DeviceGray store setgray      } def} if
	/setrgbcolor   load type /operatortype eq {/setrgbcolor   {/colorspaceJDAW /DeviceRGB  store setrgbcolor  } def} if
	/sethsbcolor   load type /operatortype eq {/sethsbcolor   {/colorspaceJDAW /DeviceRGB  store sethsbcolor  } def} if
	/setcmykcolor  load type /operatortype eq {/setcmykcolor  {/colorspaceJDAW /DeviceCMYK store setcmykcolor } def} if
	/setpattern    load type /operatortype eq {/setpattern    {/colorspaceJDAW [/Pattern [currentcolorspace 0 get dup /Pattern eq {pop /DeviceRGB} if] ] store  setpattern} def} if

	/setcolor {1 {
		currentcolorspace /DeviceGray eq {dup 0 eq {0 0 1 setcmykcolor} {setgray} ifelse exit} if
		currentcolorspace /DeviceRGB  eq {3 copy 0 eq exch 0 eq and exch 0 eq and {1 setcmykcolor} {setrgbcolor} ifelse exit} if
		currentcolorspace /DeviceCMYK eq {setcmykcolor exit} if
		setcolor
	} repeat} def

	% Without the next images from an iPhone (but not from my camera) fail (both having been through GraphicConverter to PNG). No, I don't know why.
	/image     load type /operatortype eq {/image     {colorspaceJDAW setcolorspace image    } def} if
	/imagemask load type /operatortype eq {/imagemask {colorspaceJDAW setcolorspace imagemask} def} if
} bind if  % ... /operatortype ..., just in case this file has already been prepended.


[toc] | [prev] | [next] | [standalone]


#3174

Fromjdaw1 <jdawiseman@gmail.com>
Date2017-08-31 09:36 -0700
Message-ID<1067bedc-2898-4f79-a711-52ac3fa1dca4@googlegroups.com>
In reply to#3171
Further improvements follow. Again, expert comment welcomed.



%!PS

% This version 17:00 Thu 31 Aug 2017 by Julian Wiseman of www.jdawiseman.com, based on original by 'ken'.
% Microsoft Word doesn't make proper CMYK printers' black. Print to PostScript; prepend this; distill. Fixed.
% http://groups.google.com/forum/#!topic/comp.lang.postscript/6JW6VamdVlw

/setcolor load type /operatortype eq
{
	/ClrSpcOrig currentcolorspace def

	[
		[  /setcolorspace   {/ClrSpcOrig 1 index     store   setcolorspace                                                                    }  ]
		[  /setgray         {/ClrSpcOrig /DeviceGray store dup 0 eq                                {0 0 1 setcmykcolor} {setgray}     ifelse  }  ]
		[  /setrgbcolor     {/ClrSpcOrig /DeviceRGB  store 3 copy 0 eq exch 0 eq and exch 0 eq and {    1 setcmykcolor} {setrgbcolor} ifelse  }  ]
		[  /sethsbcolor     {/ClrSpcOrig /DeviceRGB  store dup 0 eq                  {pop pop pop 0 0 0 1 setcmykcolor} {sethsbcolor} ifelse  }  ]
		[  /setcmykcolor    {/ClrSpcOrig /DeviceCMYK store                                                setcmykcolor                        }  ]
		[  /setpattern      {/ClrSpcOrig [/Pattern [currentcolorspace 0 get dup /Pattern eq {pop /DeviceRGB} if] ] store  setpattern          }  ]
	] {aload pop 1 index load type /operatortype eq {bind def} {pop pop} ifelse} forall

	/setcolor {1 {
		currentcolorspace /DeviceGray eq {setgray      exit} if
		currentcolorspace /DeviceRGB  eq {setrgbcolor  exit} if
		currentcolorspace /DeviceCMYK eq {setcmykcolor exit} if
		setcolor
	} repeat} bind def

	% Without the next, some but not all images fail. No, I don't know why.
	/image     load type /operatortype eq {/image     {ClrSpcOrig setcolorspace image    } bind def} if
	/imagemask load type /operatortype eq {/imagemask {ClrSpcOrig setcolorspace imagemask} bind def} if
} if  % ... /operatortype ..., just in case this file has already been prepended.


[toc] | [prev] | [next] | [standalone]


#3190

Fromjdaw1 <jdawiseman@gmail.com>
Date2017-11-13 14:16 -0800
Message-ID<84fdd85d-3048-47f3-aa77-93540cccb7cd@googlegroups.com>
In reply to#3174
Much improved, more powerful, better-tested version at 
http://www.jdawiseman.com/2017/20171113_TrueBlack.ps 

Comment very much welcomed.

[toc] | [prev] | [next] | [standalone]


#3191

Fromjdaw1 <jdawiseman@gmail.com>
Date2017-11-14 15:02 -0800
Message-ID<38d243a2-ab62-4864-bbe4-422fb85b0835@googlegroups.com>
In reply to#3190
> http://www.jdawiseman.com/2017/20171113_TrueBlack.ps 
File updated. 

[toc] | [prev] | [next] | [standalone]


#3196

Fromjdaw1 <jdawiseman@gmail.com>
Date2017-11-16 15:57 -0800
Message-ID<ced4855f-61ea-46d5-b144-d6111d20f5f6@googlegroups.com>
In reply to#3191
File updated again, following help received at 
http://groups.google.com/forum/#!topic/comp.lang.postscript/qdnmTjtlmJc 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web