Bug 696076 - Ghost script 9.16/9.15 print PDF layer even if print state is "Never Print"
Summary: Ghost script 9.16/9.15 print PDF layer even if print state is "Never Print"
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 9.16
Hardware: PC Windows 8
: P4 enhancement
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-02 03:24 UTC by Andrei Chesnoiu
Modified: 2017-05-31 05:56 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
originalPDF others test pdf and output (15.85 MB, application/zip)
2015-07-02 03:24 UTC, Andrei Chesnoiu
Details
Reduced and decompressed file (445.53 KB, application/pdf)
2015-07-02 06:05 UTC, Ken Sharp
Details
NeverPrintSettings (296.38 KB, image/png)
2015-07-02 06:52 UTC, Andrei Chesnoiu
Details
originalPDFlayerSettings (306.64 KB, image/png)
2015-07-02 06:52 UTC, Andrei Chesnoiu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Chesnoiu 2015-07-02 03:24:58 UTC
Created attachment 11777 [details]
originalPDF others test pdf and output

I use ghost script 9.15 and 9.16 with command gswin64c.exe -q -dBATCH -dNOPAUSE -dNOPROMPT -sDEVICE=tiffg4 -r400x400 -sOutputFile="...test.tiff" -dFirstPage=1 -dLastPage=1 "...\originalPDF.pdf.

When i use ghost script the output file contain a label about Autodesk(see lable.png or lable.tiff into attached files). This label is not visible in Adobe Reader and is not printed if I used AdobeReader or Adobe PDF Processing Library.

For the originalPDF.pdf only that AutoDesk label must be do not printed, all other information into a layer must be printed.

other tests and additional information:
This label is located in layer "0" into PDF files, if i change print state for this layer to "Never Prints" did not help, continue all layer is printed. Only if i put Default state to "Off" then layer "0" will not be printed. I also attached another two PDF files with some layer "0" changes.
Comment 1 Ken Sharp 2015-07-02 06:04:38 UTC
> other tests and additional information:
> This label is located in layer "0" into PDF files, if i change print state
> for this layer to "Never Prints" did not help, continue all layer is
> printed. Only if i put Default state to "Off" then layer "0" will not be
> printed. I also attached another two PDF files with some layer "0" changes.

That is, essentially, the way that our PDF interpreter works. You cannot change the initial state of a layer (because we are not an interactive application), so the 'visibility' of the optional content group is always whatever the default setting for that group is.

We use the 'visibility', not the 'print' setting of the optional content group, because that's what people expect, they want the output from Ghostscript to match what they see on the screen in Acrobat. 

So, if you set the visibility to not visible, then the PDF file is written with the group defined in the /OFF array. If it defaults to visible the group is not present in the /OFF array and so we render it.

In order to process the 'print' sub-state we would need to handle the /AS array, search out the /Category containing the /Print key and use the /OCGs array instead of checking /OFF. Anything not present in the OCGs array would be printed.

This would be a significant change in the behaviour of Ghostscript and would have to be controlled by a separate parameter.


What is perhaps more intriguing is that I'm unable to get Acrobat to display this text *at all*.
Comment 2 Ken Sharp 2015-07-02 06:05:50 UTC
Created attachment 11778 [details]
Reduced and decompressed file

Much simplified file.
Comment 3 Andrei Chesnoiu 2015-07-02 06:51:02 UTC
Ok. But for file NeverPrint.pdf layer 0 is set to Never Visible and Never Print (see attached file NeverPrintSettings.png) and is not display or print in Adobe Reader.


Also in the fisrt file "originalPDF.pdf" (this is the original problem) layer is visible (see originalPDFlayerSettings.png) but AutoDesk label isn't view or print in Adobe Reader. 

One last question for the originalPDF.pdf: That is GhostScript behavior to print all content exist in to a visible layer whatever the container object properties?
Comment 4 Andrei Chesnoiu 2015-07-02 06:52:17 UTC
Created attachment 11779 [details]
NeverPrintSettings
Comment 5 Andrei Chesnoiu 2015-07-02 06:52:40 UTC
Created attachment 11780 [details]
originalPDFlayerSettings
Comment 6 Ken Sharp 2015-07-02 07:23:04 UTC
(In reply to Andrei Chesnoiu from comment #3)
> Ok. But for file NeverPrint.pdf layer 0 is set to Never Visible and Never
> Print (see attached file NeverPrintSettings.png) and is not display or print
> in Adobe Reader.

We only check whether it is visible, nothing else.


> One last question for the originalPDF.pdf: That is GhostScript behavior to
> print all content exist in to a visible layer whatever the container object
> properties?

Yes, we render Optional Content Groups if they are visible (ie not present in the /OFF array).
Comment 7 Ken Sharp 2017-05-31 05:56:30 UTC
Commit 9e621d6ffb0e29c5de8331bf2c95003c8cf85941
 addresses this.

Previously we only considered the /OFF array in the OCProperties dictionary when deciding if Optional Content should be rendered. We now check Optional Content which is not listed in the /OFF array for a /Usage dictionary and apply either the /View or /Print values from that dictionary (if present).

Note that if -dPrinted is true then we will use the Print value otherwise we will use the View value. If -dPrinted is not set on the command line, then the interpreter will treat it as set if the current device has OutputFile set.