Sumatra PDF is a PDF, ePub, MOBI, CHM, XPS, DjVu, CBZ, CBR reader for Windows

Open PDF to a specific bookmarked page

We have a need to open certain PDFs to a specific page other than page 1. I use PDFill to create and edit our documents. I have created a sample 3-page document and saved it so that it opens on page 2 instead of page 1. Adobe and Foxit both open it correctly, but Sumatra always opens it to page 1. I’ve tried both versions 3.1.2 and 3.2. I’ve also looked for any advanced preferences to that regard with no joy. Any ideas?

Sample file

Adobe and Foxit reader will run the code or directives within the PDF which then go to page 2

The bookmarks are WRONG
name: default view
“Page 1” page:1 destkind:scrollTo destname:#1 pos:24449.3,24449.3
“Page 2” page:2 destkind:scrollTo destname:#2 pos:24446.3,24446.3
“Page 3” page:3 destkind:scrollTo destname:#3 pos:24446.5,24446.5

SumatraPDF is more secure and will not run such code or directives thus has to be told to open that badly bookmarked file at page 2 (it will not be able to go correctly to the bad “Page 2” reference)

SumatraPDF.exe -page 2 “BkMkTest.pdf”

if the bookmarks were good you could also use

SumatraPDF.exe -named-dest “Page 2” “BkMkTest.pdf”

You could export the bookmarks using a pre-release version (but not current one which temporarily has a now reported bug!)
image
Change them to

version: 998
name: Correct view
"Page 1" page:1 destkind:scrollTo destname:#1 pos:0,0
"Page 2" page:2 destkind:scrollTo destname:#2 pos:0,0
"Page 3" page:3 destkind:scrollTo destname:#3 pos:0,0

Then as shown above they should work in SumatraPDF 3.2

I can’t dispute your assertion that they’re wrong, I don’t know that much about the internals of PDF files. I can say, however, that up to this point, the bookmarks created with PDFill have worked flawlessly with Sumatra - including multi-level ones.

PDFill exports and imports bookmarks as .XML files. (I tried to show the XML text, but the forum editor was trying to interpret it - sorry)

I’m not sure how going to a specific page upon opening is insecure.

Unfortunately, this solution won’t work for us. We use Sumatra as our default viewer and users are accustomed to just double-clicking on the PDF they wish to view. To use your proposed method, a shortcut or batch file would need to be created for each file and everyone would have to be re-trained.

Finally, I could not replicate the screenshot you included giving the option to export bookmarks within Sumatra - even ver. 3.2. I’d like to know how you got there.

In summary,

  1. The bookmarks that PDFill creates are WRONG, even though they work within Sumatra
  2. Opening to a specified page via an internal directive is insecure and so probably won’t be implemented in Sumatra.

Thank you for your help - it looks like I may have to find another methoe or a different PDF editor.

Russ

Russ

Whilst testing deeper I found that there appears to be a difference using PDFill
version 14 and 15 it makes no difference in SumatraPDF 3.2 for your wish to use an automatic means to jump to page 2.
However I found PDFill 15.0 output was more reliable especially as it also highlighted another issue that may need resolving in SumatraPDF and I will at the same time query automatic goto.

Appologies I was in error to say the bookmarks were wrong, it was a bug in the version I used for testing (my bad :blush: )

Your sample file contains almost exactly the same entry (/OpenAction<</S/GoTo/D[8 0)… as a well known means to exploit PDF in order to force a user to a malicious location, obviously your file is safe as the desired action is to simply goto page 2

I have previously requested that SumatraPDF use the stored preference to open at a given page e.g. page 2 as that is partly noted in SumatraPDF use of alternative bookmarks.

You rightly mention (I forgot) that whilst 3.2 will accept both .bkm and .vbkm files (just like Highlights) but they are only generated by Pre-Release versions.

A .vbkm can store the desire to open at page 2 but currently requires the user to select the default. I.e. it currently will not apply it automatically (but could?)

I have opened an issue to match your request that SumatraPDF safely goes to a default page.

Thank you so much for clarifying and for opening the issue for me - truly appreciated.

I have not upgraded to PDFill V. 15 yet because it is still (for over a year now) in beta testing. Once it becomes a stable release, I will upgrade, but I can’t afford the time at this point to be a tester. If the Sumatra issue is resolved and is dependent on that version, I will take the leap at that time.

Thanks again,

Russ