Bug 695252

Summary: /DOCVIEW pdfmark ruins /OpenAction
Product: Ghostscript Reporter: Heiko Oberdiek <heiko.oberdiek>
Component: PDF WriterAssignee: Ken Sharp <ken.sharp>
Status: RESOLVED WORKSFORME    
Severity: normal CC: heiko.oberdiek
Priority: P4    
Version: 9.14   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: Test file for reproducing the bug. It should open at page 2.

Description Heiko Oberdiek 2014-05-21 19:10:44 UTC
Created attachment 10923 [details]
Test file for reproducing the bug. It should open at page 2.

PDF key /OpenAction of /Catalog does not work, when generated by a /DOCVIEW pdfmark.

This is a regression:
* 9.07 is fine,
* 9.10 and up to 9.14 and master are broken.

The following /DOCVIEW pdfmark:

    [ /PageMode /UseThumbs
      /Page 2
      /View [/FitH 792]
    /DOCVIEW pdfmark

should generate the following /Catalog object (formatted for readability):

    <<
      /Type /Catalog
      /Pages 3 0 R
      /OpenAction [4 0 R /FitH 792]
      /PageMode /UseThumbs
      /Metadata 17 0 R
    >>

However the entries for /OpenAction are not converted into an
action object for key /OpenAction. Instead /OpenAction is missing and
the pdfmark keys value pairs for the action are copied top level into
the /Catalog object:

    <<
      /Type /Catalog
      /Pages 3 0 R
      /PageMode /UseThumbs
      /Page 2
      /View [/FitH 792]
      /Metadata 17 0 R
    >>

I have attached the file "openaction.ps" that should open at page 2, but opens page 1 because of the wrong open action specification.

Command line to generate the PDF file:

    gs -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -sOutputFile=openaction.pdf openaction.ps
Comment 1 Ken Sharp 2014-05-24 02:09:12 UTC
I believe that this was fixed with commit c79b0ee1dbc1cbbcbe406abd4bc47f617ed5cb2c
on the 23rd April 2014 (which makes the assertion that master is broken suspect).

The commit log says:

"Finally, while investigating the problems, I noticed a logical error with
DOCVIEW pdfmarks which could result in Open actions being written incorrectly
and this is also fixed here."

The specimen file produces a PDF file which works for me in Acrobat, and where the OpenAction appears to be correct in the PDF file.