Bug 695252 - /DOCVIEW pdfmark ruins /OpenAction
Summary: /DOCVIEW pdfmark ruins /OpenAction
Status: RESOLVED WORKSFORME
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: 9.14
Hardware: PC Linux
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-21 19:10 UTC by Heiko Oberdiek
Modified: 2014-05-24 02:09 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
Test file for reproducing the bug. It should open at page 2. (469 bytes, application/postscript)
2014-05-21 19:10 UTC, Heiko Oberdiek
Details

Note You need to log in before you can comment on or make changes to this bug.
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.