Bug 397373 - Links no longer work after saving annotated PDF
Summary: Links no longer work after saving annotated PDF
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.4.3
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 398542 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-08-11 11:09 UTC by Pastafarianist
Modified: 2018-09-12 15:47 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 18.08.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pastafarianist 2018-08-11 11:09:42 UTC
tl;dr: open a PDF with links, highlight a few lines using the "Highlighter" annotation tool, press Ctrl+S and observe that hovering over links no longer changes the cursor, and clicking on them has no effect.

Detailed steps to reproduce:

1. Download a PDF with links, e.g. https://www.nature.com/articles/s41598-018-23534-9.pdf
2. Open it in Okular.
3. Make sure that the links work (e.g. the superscript references or the authors' emails).
4. Press F6, then 4.
5. Select some text, for example, a sentence from the abstract.
6. Press Ctrl+S.
7. Note that the links no longer work, i.e. the cursor no longer changes shape when you hover over them, and clicking has no effect.
Comment 1 Oliver Sander 2018-08-11 14:23:13 UTC
Confirmed with current git master on Debian testing.
Comment 2 Tobias Deiminger 2018-08-11 14:33:13 UTC
Also confirmed for Okular master. If you reload the document with F5, links work again and the bug is gone. So it's not the file itself that gets corrupted.

While the bug is active, in PageView::updateCursor

const Okular::ObjectRect * linkobj = pageItem->page()->objectRect( Okular::ObjectRect::Action, nX, nY, pageItem->uncroppedWidth(), pageItem->uncroppedHeight() );

is executed, but linkobj always gets assigned with nullptr. Had no time to dig deeper yet.
Comment 3 Albert Astals Cid 2018-08-11 21:18:35 UTC
Tobias can you have a look at https://phabricator.kde.org/D14752 ?
Comment 4 Tobias Deiminger 2018-08-12 06:44:27 UTC
(In reply to Albert Astals Cid from comment #3)
> Tobias can you have a look at https://phabricator.kde.org/D14752 ?
Wow, that was fast. Yes I'll have a look within the next two or three days.

@Oliver: Will need to do a small writeup for myself to understand how Alberts diff is working. I'll share it, then you can check if it's suitable as explanation in code comment or git commit message (the later is easy to find with git blame, would also be ok for me).
Comment 5 Pastafarianist 2018-08-12 07:26:32 UTC
Original reporter here. I must say that your response time is very impressive, usually with open-source projects I have to wait for weeks or months for a fix. Great job!
Comment 6 Albert Astals Cid 2018-08-26 23:09:36 UTC
Git commit 0a8d2f7f85750d3852f256ebc8f0e8c9bad9fd84 by Albert Astals Cid.
Committed on 26/08/2018 at 23:09.
Pushed by aacid into branch 'Applications/18.08'.

Fix links being "lost" on save

Summary:
We need to regenerate the links when switching the file
since we won't re-render the pages since we already have
them and link generation is on page render

Reviewers: tobiasdeiminger

Reviewed By: tobiasdeiminger

Subscribers: tobiasdeiminger, sander, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D14752

M  +19   -0    generators/poppler/generator_pdf.cpp

https://commits.kde.org/okular/0a8d2f7f85750d3852f256ebc8f0e8c9bad9fd84
Comment 7 Luigi Toscano 2018-09-12 15:47:16 UTC
*** Bug 398542 has been marked as a duplicate of this bug. ***