Comment 3 for bug 1442874

Revision history for this message
Adam Reichold (adamreichold) wrote : Re: [Bug 1442874] Re: Jumping pages/following links changes horizontal position

Hello,

Am 15.04.2015 um 11:36 schrieb Thomas Weidner:
> I tried your branch and following links now works much better. I did not
> find a case, where the viewport was badly positioned.

I will merge this into trunk when I find some spare time to do so then.

> I attached a test PDF where clicking the link in the last line positions
> the viewport to the right, whereas the target of the link (the equation
> or the "(1)" in the equation) would be visible without changing
> horizontal scrolling.

I tested the document and it seems to work as intended: The link
contains set-left-of-viewport 0.48 (relative to page with) and
set-top-of-viewport 0.35 (relative to page height) which positions the
top left of the viewport left and above of the equation itself, i.e.
right next to the a character.

So we are explicitly requested to adjust the horizontal and vertical
position by the link. Whether a link target that is centered on the page
is optimal is debatable, but this is up to the document itself.

We could of course opt to interpret that request as to only scroll if
this position is not already inside the viewport, but as this is pretty
intrusive and hence I added a setting called "scroll if not visible" to
the behaviour tab of the related branch. Please try give it a try as
well. Thanks!

> Trim margins looks really nice, but has scrolling bugs of its own: When
> the PDF file is refreshed (because a new version is written by the latex
> compiler) the vertical scroll position changes slightly (like ~5 lines
> of text). So after a series of recompilations the area of interest
> eventually moves out of the viewport.

This is caused by the page dimensions changing after the first render
pass, i.e. after the margins have been trimmed. When page-relative
positions w.r.t. the original size are then restored w.r.t. to the
trimmed size, the real position changes.

The problem actually goes deeper insofar all page-relative locations are
computed using the modified instead of the original bounding box. When I
merge the mentioned branch, I will try to replace all page-relative
position computations using the unmodified bounding box which should
hopefully resolve most of these issues...

Best regards, Adam.

> ** Attachment added: "test-eq.pdf"
> https://bugs.launchpad.net/qpdfview/+bug/1442874/+attachment/4376071/+files/test-eq.pdf
>