sumatrapdf icon indicating copy to clipboard operation
sumatrapdf copied to clipboard

Bookmark links jump to one page after?

Open ScottMaclure opened this issue 2 years ago • 3 comments

Installed SumatraPDF-3.4.5-64-install.exe on Win10.

When I click a bookmark, it jumps to the page AFTER the bookmark.

Have observed the same behaviour in two separate PDFs.

Have tested those same PDFs in Okular, do not have the same problem (bookmarks jump to correct page).

ScottMaclure avatar Jun 08 '22 00:06 ScottMaclure

In general: no.

I would need a sample document and step-by-step instructions to reproduce the issue.

kjk avatar Jun 08 '22 01:06 kjk

It's not happening for all PDFs, but can reproduce on Win10 with latest Sumatra for this one:

https://www.drivethrurpg.com/product/115059/LotFP-Rules--Magic-Free-Version

Here's a direct link to the PDF: https://mega.nz/file/zkFjnZDI#qUOq4_Nom2Bv5OJdtmtLej_SAennuwbis_K5KNXeev0

(Sorry for the nerdy subject matter!)

Have been messing about with display and font scaling, to see if that affects anything.

ScottMaclure avatar Jun 10 '22 04:06 ScottMaclure

I'm having the same problem on about all PDFs I use (they mainly come from the same source, the brazilian legal system, the digital records of the cases).

It happens only in sumatra.

AmamosV avatar Sep 19 '22 13:09 AmamosV

I am in the same situation with some schematic documents generated with Altium. Other PDF viewers behave just fine with links within the document, but SumatraPDF jumps to the page after. Sorry I cannot share an example document due to intellectual property.

I have extended one of the document with QDF and then opened with text editor: for example one documents has 6 pages and I see those as 6 linkable object at beginning of file

%% Original object ID: 1 0
5 0 obj
<<
  /Count 6
  /Kids [
    8 0 R
    9 0 R
    10 0 R
    11 0 R
    12 0 R
    13 0 R
  ]
  /Type /Pages
>>
endobj

One of the links looks like

%% Original object ID: 1574 0
573 0 obj
<<
  /D [
    8 0 R
    /FitR
    0
    799
    1115
    0
  ]
  /S /GoTo
>>
endobj

that links to the 1st page, but SumatraPDF jumps to the 2nd one.

Just guessing, as the link to the page is too easy to be mistaken, maybe the /FitR coordinates are interpreted so that SumatraPDF points between the end of page 1 and beginning of page 2? Could anybody please point me to the source code where this links are parsed?

tiol11 avatar Sep 27 '22 21:09 tiol11

@tiol11 I am also seeing this with PDFs generated by Altium. I was able to get it behaving a bit better (though not perfectly) by changing pageNo + 1 to pageNo, at https://github.com/sumatrapdfreader/sumatrapdf/blob/b49630b0995e7748ecf1b1d60bafdaf1d07f8179/src/EngineMupdf.cpp#L2834

But I seriously doubt that this is the correct fix, and suspect that it would probably break links in other documents. I haven't had a chance to dig in and understand the code, or how the links are parsed, etc.

sullivanmj avatar Nov 07 '23 14:11 sullivanmj

This is fixed in latest pre-release, at least for the repro file https://mega.nz/file/zkFjnZDI#qUOq4_Nom2Bv5OJdtmtLej_SAennuwbis_K5KNXeev0

Specifically: if I click on Cleric entry in bookmarks, it takes me to the beginning of page 11 while in 3.4.5 it would be end of page 11 which looks like start of page 12.

If it still happens for you in latest pre-release, please re-open this issue and attach a sample document that shows the problem.

kjk avatar Nov 07 '23 14:11 kjk

@kjk It doesn't look like I have permission to reopen this issue. I have attached a sample document below, created in Altium Designer version 23.8.1, that exhibits the behavior I mentioned. I am using b49630b (the current prerelease version).

The links appear to work correctly with this particular pdf while using:

  • Acrobat Reader: 2023.006.20360
  • Microsoft Edge: 118.0.2088.76 (Official build) (64-bit)
  • Google Chrome: 119.0.6045.123 (Official Build) (64-bit) (cohort: M119 Rollout)

PCB_Project.pdf

The green rectangles on the first page are supposed to link to the specified sheet. I noticed that the highlighted/selected bookmark appears to be correct after clicking a link, but the bookmarks also appear to correspond to the incorrect sheet.

Please let me know if I can help in any way or provide any more information.

sullivanmj avatar Nov 08 '23 01:11 sullivanmj

Hmm in single page mode the bookmarks are jumping to correct page as they are defind at the boundary from PDF origin page bottom as fullpage

@kjk my feeling is that in continuous mode the page area is based on top of page origin thus the page above is not shown but the scroll to bottom edge translates into show the page below.

GitHubRulesOK avatar Nov 08 '23 05:11 GitHubRulesOK

@sullivanmj I've opened #3860 to track this

kjk avatar Nov 08 '23 09:11 kjk