Created attachment 6817 [details] 123.pdf After the conversion of 123.pdf to gs_123.pdf, the document-level navigation does not work. All /Dest-entries are pointing to the first page. GS-call: gs -sDEVICE=pdfwrite -o gs_123.pdf
Created attachment 6818 [details] gs_123.pdf
The problem seems to actually be in the PDF *interpreter* which is not passing the /Dest argument to the constructed pdfmark, which is what pdfwrite uses. Since pdfwrite isn't getting a destination, it uses the current page. Because outlines are written right at the start, the current page is always the first one. I'll see if I can figure out what the PDF interpreter ought to be doing, so that I can pass it to Alex for approval.
Created attachment 6835 [details] Patch for the issue The attached patch works for me. If we have a View and a Page, but no matrix (not required if we have a /View [/Fit]) then do not discard the page number but use it as a /Page argument (adding one because pdfmark starts from page 1, not 0). I'm not absolutely sure what this PostScript is doing, or why it previously chose to discard the page number, so I've coded this in a way where it only uses the page number if its an integer (just in case there's some weird path I haven't traced). This resolves the reported problem for me, but this is not my code and I'm pretty hazy on what exactly its doing, so this patch needs to be reviewed by Alex before being committed, hence I'm reassigning the bug to him for review.
Re-assigning to Alex as the problem is in the PDF interpreter, not the PDF writer.
I don't have much to add to Ken's comments. The patch looks fine to me. It's committed as a rev. 49ae789184ebb094c29b14a6778e8fa823f6637a