Bug 689289 - Optional Content (OC) ignored in PDF.
Summary: Optional Content (OC) ignored in PDF.
Status: NOTIFIED DUPLICATE of bug 690633
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: PC Linux
: P2 enhancement
Assignee: Ken Sharp
URL:
Keywords:
: 689716 689924 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-19 11:11 UTC by Marcos H. Woehrmann
Modified: 2011-09-18 21:45 UTC (History)
1 user (show)

See Also:
Customer: 581
Word Size: ---


Attachments
Partial patch (757 bytes, patch)
2009-11-15 15:53 UTC, Alex Cherepanov
Details | Diff
partial patch (4.35 KB, patch)
2009-11-15 16:28 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2007-06-19 11:11:42 UTC
The customer reports and I've verified that the attached file renders
incorrectly with gs8.57.  In particular:

1. The little image at the left top edge is degradated to
   just a line.

2. The foreground layer image is black: When opening the
   PDF in Acrobat you will find layer switches (optional
   content). If you turn off the switch "Text Color" in
   Acrobat you will see that part of the page becomes black.
   Ghostscript renders the layers as if the "Text Color"
   switch is turned off. But it is turned on by default.

See the attached screenshot.png for a comparison of Acrobat (top) to Ghostscript
8.57 (bottom).

The command line I used for testing:

  bin/gs -sDEVICE=ppmraw -sOutputFile=test.ppm -r200 ./p1_RGB_palette.pdf

gshead and gs8.56 fail the same way.  Earlier versions of Ghostscript core dump
with the file.
Comment 1 Marcos H. Woehrmann 2007-06-19 11:12:03 UTC
Created attachment 3039 [details]
screenshot.png
Comment 2 Marcos H. Woehrmann 2007-06-19 11:12:22 UTC
Created attachment 3040 [details]
p1_RGB_palette.pdf
Comment 3 Ray Johnston 2007-06-19 12:05:41 UTC
Optional Content is not currently supported.

We will need to evaluate the difficulty of this enhancement and if/when we
decide to develop it, we need to first develop a specification for controlling
the visibility of the Optional Content (Layers).
Comment 4 Ray Johnston 2007-06-19 12:08:22 UTC
The missing image appears to be a separate bug. No warnings are issued about
the image (as would happen with an error).

If it is determined that the missing image is not related to the Optional
Content (I suspect that it is not), please open a separate bug about the
missing image.
Comment 5 Alex Cherepanov 2007-06-20 16:26:05 UTC
The missing image problem is related to soft masking.
It is tracked now as a bug 689290.
Comment 6 Marcos H. Woehrmann 2007-06-21 14:34:21 UTC
From the Layer Properties panel in Acrobat Reader it appears that layers have a
"Default state" (which is on for the non-background layer in the attached file).  
Comment 7 Ray Johnston 2007-06-26 09:41:58 UTC
Since the Optional Content is turned on by the PDF, we should process it.

Later we may want to add controls for which OC layers get displayed.

The development of the 'control' of layers can be opened as a separate issue.
Comment 8 Alex Cherepanov 2008-06-27 05:03:05 UTC
*** Bug 689924 has been marked as a duplicate of this bug. ***
Comment 9 Ray Johnston 2008-12-09 10:53:50 UTC
A suggestion for implementing the enhancement is to add arrays for
EnableOC and DisableOC which would be a list of names (strings)  to force "on"
or "off" when processing. For example:

   -c /EnableOC [ (Background) ] def /DisableOC [ (Text Color) ]

By default, we should use the 'default visiblilty'.

This enhancement is needed to render selectively, but when the output is the
pdfwrite device, we probably should pass the layers through, with the
EnableOC and DisableOC list use to set default visibility.

Henry and Alex agreed that this to be passed to Ken, since the PDF interp
changes must come first, but passing the lists and the OCGName (layer name)
to the pdfwrite device is in Ken's area.
Comment 10 Ray Johnston 2008-12-16 10:14:02 UTC
*** Bug 689716 has been marked as a duplicate of this bug. ***
Comment 11 Alex Cherepanov 2009-11-15 15:53:58 UTC
Created attachment 5673 [details]
Partial patch

This patch only skips XObjects. Contents streams and annotations are not yet
implemented. 

This is enough to fix OC-related issues with the sample file.
Comment 12 Alex Cherepanov 2009-11-15 16:28:19 UTC
Created attachment 5674 [details]
partial patch

Please ignore my previous patch. It's unrelated to this problem.
Comment 13 Alex Cherepanov 2009-11-16 21:22:18 UTC

*** This bug has been marked as a duplicate of 690633 ***
Comment 14 Marcos H. Woehrmann 2011-09-18 21:45:58 UTC
Changing customer bugs that have been resolved more than a year ago to closed.