Bug 142741 - Wrong link rectangle calculation while exporing PDF with footnotes when footnote body not on the same page as footnote anchor
Summary: Wrong link rectangle calculation while exporing PDF with footnotes when footn...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium normal
Assignee: Georgy Litvinov
URL:
Whiteboard: target:7.2.0 unitTestNotes:9
Keywords: preBibisect, regression
Depends on:
Blocks:
 
Reported: 2021-06-09 16:25 UTC by Georgy Litvinov
Modified: 2023-10-17 07:40 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
document to create pdf (8.57 KB, application/vnd.oasis.opendocument.text)
2021-06-09 16:26 UTC, Georgy Litvinov
Details
document with broken link (10.18 KB, application/pdf)
2021-06-09 16:27 UTC, Georgy Litvinov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Georgy Litvinov 2021-06-09 16:25:19 UTC
Description:
While exporting document to PDF link annotation has wrong Y coordingate (out of page area). That making the link effectively unusable and absent for users.

Steps to Reproduce:
1. Create document with footnote, make footnote body move to next page.
2. Export to PDF
3. Verify that footnote anchor in text is not clickable

Actual Results:
No link available. Clicking on footnote anchor does nothing.

Expected Results:
Clicking on footnote anchor should send user to target page with footnote body.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
With page Y dimension 841.889763779528
Y coordinate is out of page size 1627.489

% PDFPage::emit
4 0 obj
<</Type/Page/Parent 8 0 R/Resources 15 0 R/MediaBox[0 0 595.303937007874 841.889763779528]/Group<</S/Transparency/CS/DeviceRGB/I true>>/Contents 5 0 R>>
endobj



% PDFWriterImpl::emitLinkAnnotations
7 0 obj
<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[56.693 1627.489 60.257 1641.289]/Dest[4 0 R/XYZ 73.7 68.239 0]>>
endobj
Comment 1 Georgy Litvinov 2021-06-09 16:26:15 UTC
Created attachment 172745 [details]
document to create pdf
Comment 2 Georgy Litvinov 2021-06-09 16:27:25 UTC
Created attachment 172746 [details]
document with broken link
Comment 3 Georgy Litvinov 2021-06-09 17:50:18 UTC
841 - (-785.6) = 1627.489
Correct Y coordinate should be 785.6
Comment 4 Georgy Litvinov 2021-06-10 08:32:39 UTC
Coordinates from file where footnote anchor and footnote body are on the same page
and link is placed correctly(working)
<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[56.693 771.389 60.257 785.189]/Dest[1 0 R/XYZ 73.7 68.239 0]>>
Comment 5 Commit Notification 2021-06-13 14:27:57 UTC
Georgy Litvinov committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/51d1952cf05381a48e6b0797d5e001452181b1ec

tdf#142741 and tdf#38187 Set valid pages for footnote links PDF export.

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Timur 2021-06-14 13:06:15 UTC
Very nice to see already a fix, I set Assignee, I see that Georgy had a couple of them before.

This one is somewhat duplicate to bug 38187, but better defined. 
I see that one-way link (number>text) is fixed, both for footnote and endnote. 

Please explain if you intend to fix also other way, text>number.
Comment 7 Georgy Litvinov 2021-06-14 18:51:43 UTC
> Please explain if you intend to fix also other way, text>number.
I plan to fix other way too (working on it), but that would be related to 38187 only.
Comment 8 Timur 2021-06-15 07:04:51 UTC
Thanks. So you may mark this one Fixed. 
This was on my personal "annoying" list. 
And it was regression from 3.5, one-way worked in LO 3.4, so preBibisect.
Comment 9 Buovjaga 2023-10-17 07:40:35 UTC
Notes for unit test writers:

Revert has to be done manually.

PDF exports can be checked with pdfium, see for example sw/qa/extras/globalfilter/globalfilter.cxx