Bug 695980 - pdfwriter gray-text converted to black text and printed opaque.
Summary: pdfwriter gray-text converted to black text and printed opaque.
Status: NOTIFIED DUPLICATE of bug 692853
Alias: None
Product: GhostPCL
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: PC Windows 7
: P2 normal
Assignee: Henry Stiles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-08 02:38 UTC by norbert.janssen
Modified: 2015-06-05 15:22 UTC (History)
1 user (show)

See Also:
Customer: 661
Word Size: ---


Attachments
pcl testfile (2.66 MB, application/octet-stream)
2015-05-08 02:38 UTC, norbert.janssen
Details
jpeg output page (187.32 KB, image/jpeg)
2015-05-08 02:39 UTC, norbert.janssen
Details
pdf output (2.07 MB, application/pdf)
2015-05-08 02:39 UTC, norbert.janssen
Details
simpler pcl-xl testfile (432.18 KB, application/octet-stream)
2015-05-08 03:12 UTC, norbert.janssen
Details
pdf output for test1.bin (163.23 KB, application/pdf)
2015-05-08 03:12 UTC, norbert.janssen
Details
simplified testfile (1.04 KB, application/octet-stream)
2015-05-08 03:17 UTC, norbert.janssen
Details
generated pdf for simplified testfile (1.48 KB, application/pdf)
2015-05-08 03:18 UTC, norbert.janssen
Details
disassembled test2.bin (5.39 KB, text/plain)
2015-05-08 03:21 UTC, norbert.janssen
Details
using rop3 PSDPxax (13.72 KB, application/octet-stream)
2015-05-08 06:26 UTC, norbert.janssen
Details
disassembled test3.bin (46.00 KB, text/plain)
2015-05-08 06:27 UTC, norbert.janssen
Details
pdf output from tst3.bin (4.91 KB, application/pdf)
2015-05-08 06:29 UTC, norbert.janssen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description norbert.janssen 2015-05-08 02:38:36 UTC
Created attachment 11651 [details]
pcl testfile

with attached testfile.
obj/pcl6.exe -sDEVICE=jpeg -sOutputFile=test.jpg -r100 testfile.pcl
obj/pcl6.exe -sDEVICE=pdfwrite -sOutputFile=test.pdf testfile.pcl

test.pdf shows some artefacts for displayed state-names (NEVADA, UTAH, COLORADO etc).
the text is shown 'black' i.s.o. grey, and opaque (with white background) i.s.o. transparent.
Comment 1 norbert.janssen 2015-05-08 02:39:03 UTC
Created attachment 11652 [details]
jpeg output page
Comment 2 norbert.janssen 2015-05-08 02:39:26 UTC
Created attachment 11653 [details]
pdf output
Comment 3 Ken Sharp 2015-05-08 02:49:48 UTC
If the PCL uses raster ops then its quite likely that the result will be incorrect. PDF does not have raster ops in its graphics model, and so ignores them. The reference to 'transparent' makes me think this is likely.

This is a known limitation of pdfwrite when used with PCL input, and its unlikely we'll be able to address it, other than the obvious solution of rendering to a bitmap and wrapping that up as a PDF file.

I'm reassigning this to Henry in the first instance, because he can reduce the PCL file much more easily than I can, and can quickly tell if the problem is likely to be ROPs (well, more quickly than me anyway).

Henry, if you think its a genuine pdfwrite propblem, please pass it back to me (with a smaller file if you can please)
Comment 4 norbert.janssen 2015-05-08 03:12:08 UTC
Created attachment 11654 [details]
simpler pcl-xl testfile

a somewhat simpler testfile
Comment 5 norbert.janssen 2015-05-08 03:12:41 UTC
Created attachment 11655 [details]
pdf output for test1.bin
Comment 6 norbert.janssen 2015-05-08 03:17:49 UTC
Created attachment 11656 [details]
simplified testfile
Comment 7 norbert.janssen 2015-05-08 03:18:25 UTC
Created attachment 11657 [details]
generated pdf for simplified testfile
Comment 8 norbert.janssen 2015-05-08 03:21:41 UTC
Created attachment 11658 [details]
disassembled test2.bin
Comment 9 Ken Sharp 2015-05-08 04:10:32 UTC
Well, I'm not a PCL expert, but this:

ubyte e_P ROP3
// Operator Position: 13
SetROP

and this:

ubyte e_DSa ROP3
// Operator Position: 28
SetROP

Seem like fairly compelling evidence to me that this file uses ROPs. Again I'll have to leave it to Henry to tell me whether there's any real likelihood of us handling these in PDF. My initial impression is that we probably can't (and we already know it isn't possible in the general case with ROPs). The only way to get the output you expect is to render to a raster and wrap the raster up as a PDF file.
Comment 10 norbert.janssen 2015-05-08 06:26:43 UTC
Created attachment 11659 [details]
using rop3 PSDPxax

1 extra image placed, using the PSDPxax rop.
Comment 11 norbert.janssen 2015-05-08 06:27:12 UTC
Created attachment 11660 [details]
disassembled test3.bin
Comment 12 norbert.janssen 2015-05-08 06:29:12 UTC
Created attachment 11661 [details]
pdf output from tst3.bin

this testfile (test3.bin) also uses PSDPxax rop3. See also info below that I found using google.

1)
The ROP code 00B8074A is the boolean function B8 (bits 16-23 of the ROP code, hence the 'B8' in 00B8074A). It corresponds to the boolean function 'PSDPxax' (in postfix notation) which does the following:

    XOR destination and pattern
    AND the result with the source
    XOR the result with the pattern again.


2)
>The ROP code
>B8- 0x00B8074A- PSDPxax
>To handle this rop operation is it that, the destination rectangle is to be
>filled with downloaded pattern or just downloading the pattern to printer
>will do the need.

Actually that ROP says "use the pattern (usually monochrome) as a mask to
choose between source and dest". Where the pattern is 1, the source is
used. Where the pattern is 0, the destination is left alone. It is the
way transparency was done before GDI supported transparency. This ROP is
used, for example, to draw the icons on your desktop: the mask digs a hole
for the useful pixels in the source.


Seems to me that this should be possible with PDF.
Comment 13 Hin-Tak Leung 2015-05-08 07:28:29 UTC
(In reply to norbert.janssen from comment #12)
...
> 2)
> >The ROP code
> >B8- 0x00B8074A- PSDPxax
> >To handle this rop operation is it that, the destination rectangle is to be
> >filled with downloaded pattern or just downloading the pattern to printer
> >will do the need.
...

FWIW, I think it isn't possible to do it "easily" in the pdf imaging model. ROP3 involving the destination (i.e. "reading" what's already inked/printed back and do stuff on it and send it back) isn't a native pdf operation, so it would involve buffering and flattening the page image, which isn't a nice way to do things.

I fixed a pile of bugs in the pxl driver a while ago with ROP3's, and one of the last changes were to make ROP3 *not* involving the destination work. PXL does support ROP3 natively (and PXL to PXL should be ideally a no-op pass-through), so ROP3 involving the destination would need to be implemented by passing it through - which is, AFAIK, still an unfixed enhancement bug. I think Henry closed the report as "LATER". ( see http://bugs.ghostscript.com/show_bug.cgi?id=693056#c4 )
Comment 14 Henry Stiles 2015-05-08 07:59:05 UTC
Though this is a PXL and not PCL like the referenced duplicate, it is the same issue.  Ken describes in comment #3 of that bug the pdfwrite device doesn't even know about the rop and we don't really have a plan as to what we could do if pdfwrite could intercept the rop loading.  As Hin-Tak and Ken have said the fallback is rasterize the entire page after previewing which is something we don't want to do.

*** This bug has been marked as a duplicate of bug 692853 ***