Bug 148729 - Setting Comments to "In Margin" causes links not to be annotated in PDF exports
Summary: Setting Comments to "In Margin" causes links not to be annotated in PDF exports
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
7.0.6.2 release
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:24.2.0 target:7.6.1
Keywords:
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
 
Reported: 2022-04-22 15:21 UTC by Simon Gaeremynck
Modified: 2023-08-19 11:35 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
PDF with a hyperlink which does not export correctly when comments are set to In Margin (16.89 KB, application/pdf)
2022-04-22 15:22 UTC, Simon Gaeremynck
Details
A docx file with a hyperlink (11.89 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-05-11 12:06 UTC, Simon Gaeremynck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Gaeremynck 2022-04-22 15:21:56 UTC
Description:
When Writer is configured to print comments in the margin, it will not annotate links in documents that don't have any comments when exporting to PDF.

When there are comments in the margin, it seems to export the annotation for the link correctly.

I've wittled down my registrymodifications.xcu and traced it down to:
<item oor:path="/org.openoffice.Office.Writer/Print/Content"><prop oor:name="Note" oor:op="fuse"><value>4</value></prop></item>

Which corresponds with setting Settings > LibreOffice Writer > Print > Comments to "In Margin".

I've double-checked a few LO versions and this is present in at least 7.0.6.2 all the way up to master.

Steps to Reproduce:
1. Open Writer > Settings > LibreOffice Writer > Print > Comments > In Margin
2. Open the attached input.pdf > File > Export as PDF > Save
3. Open the PDF in a PDF viewer

Actual Results:
The URL is not annotated and therefore not clickable.

Expected Results:
The URL should be annotated and clickable.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
N/A
Comment 1 Simon Gaeremynck 2022-04-22 15:22:37 UTC
Created attachment 179733 [details]
PDF with a hyperlink which does not export correctly when comments are set to In Margin
Comment 2 Dieter 2022-05-07 07:20:53 UTC
I can't confirm with

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 83d0f2eebae41d431d9a5bfd1a918523977752d0
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Which PDF Viewer dio you use (I've used Acrobat Reader)?
Have you tested with most recent version of LO?
=> NEEDINFO
Comment 3 Simon Gaeremynck 2022-05-11 12:06:25 UTC
Created attachment 180061 [details]
A docx file with a hyperlink
Comment 4 Simon Gaeremynck 2022-05-11 12:11:05 UTC
I can confirm the issue is still present in the most recent 7.4 alpha build.

I also attached a test .docx document with a hyperlink that demonstrates the issue.

Apologies, my earlier description states to open a PDF file. That's obviously not right. This happens when you start from a _document_ which you then export into a PDF.

I use the default PDF viewer on OS x (Preview), but seeing this in other viewers such as pdf.js as well.


Version information:
Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: e5fb120a32d04e241b35a7e63894c744196f576b
CPU threads: 10; OS: Mac OS X 12.0.1; UI render: Skia/Metal; VCL: osx
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded
URL: https://dev-builds.libreoffice.org/daily/master/MacOSX-x86_64@tb81-TDF/2022-05-10_07.25.43/LibreOfficeDev_7.4.0.0.alpha0_MacOS_x86-64.dmg
Comment 5 Dieter 2022-05-11 12:37:27 UTC
(In reply to Simon Gaeremynck from comment #3)
> Created attachment 180061 [details]
> A docx file with a hyperlink

Thank you for the document. I will test it later. One question: Does it only happen with docx-files?
Comment 6 Dieter 2022-05-12 07:35:25 UTC
I've tried the following steps:
1. Open attachment 180061 [details]
2. Tools -> Options -> LibreOffice Writer -> Print -> Comments in margins
3. File -> Export As -> Export as PDF -> Export
4. Open PDF and clik on hyperlink

Result: Works
Comment 7 Simon Gaeremynck 2022-05-12 08:46:28 UTC
I think you're seeing those results because LibreOffice holds on to the previous print configuration value perhaps?

I can reproduce when doing the following:
1. Open Writer > Settings > LibreOffice Writer > Print > Comments > In Margin
2. Close LibreOffice completely
3. Open attachment 180061 [details] in LibreOffice
4. File -> Export As -> Export as PDF -> Export (I don't think it matters, but I export as tagged PDF)
5. Open PDF in a PDF viewer, notice that the link is not clickable


I reproduced this both on Mac and in a Docker container where I modify: 
  /root/.config/libreofficedev/4/user/registrymodifications.xcu 
so that it contains
  <item oor:path="/org.openoffice.Office.Writer/Print/Content"><prop oor:name="Note" oor:op="fuse"><value>4</value></prop></item>


and use the following command to convert:
  /opt/libreofficedev7.4/program/soffice --headless --minimized --invisible --nodefault --nologo --nolockcheck --norestore --convert-to pdf /tmp/test.docx  --outdir /tmp/
Comment 8 Buovjaga 2023-01-10 12:22:37 UTC
(In reply to Simon Gaeremynck from comment #7)
> I think you're seeing those results because LibreOffice holds on to the
> previous print configuration value perhaps?
> 
> I can reproduce when doing the following:
> 1. Open Writer > Settings > LibreOffice Writer > Print > Comments > In Margin
> 2. Close LibreOffice completely
> 3. Open attachment 180061 [details] in LibreOffice
> 4. File -> Export As -> Export as PDF -> Export (I don't think it matters,
> but I export as tagged PDF)
> 5. Open PDF in a PDF viewer, notice that the link is not clickable

The end result works for me with Okular and Firefox's pdf.js.

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f1d00da1bb16330bef9316a3e4f04506f9bb862f
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded Jumbo
Built on 10 January 2023
Comment 9 Commit Notification 2023-07-10 18:46:45 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f7974dc8d6d0cca08da52c4fbdb312ed6b7d71da

tdf#148729 sw: PDF export: fix link targets when "comments in margin"

It will be available in 24.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 10 Michael Stahl (allotropia) 2023-07-10 18:55:18 UTC
the link annotations exist, they are just at a wrong position (usually southwest of where they should be)

fixed on master
Comment 11 Commit Notification 2023-07-19 09:31:17 UTC Comment hidden (off-topic)
Comment 12 Michael Stahl (allotropia) 2023-07-19 09:33:19 UTC
oops i have typo'd the issue id in the commit in the previous comment, please disregard
Comment 13 Commit Notification 2023-08-03 12:02:31 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/570ca3164c57aa29d1548b179e0a9905f8b8a9b3

tdf#148729 sw: PDF export: fix link targets when "comments in margin"

It will be available in 7.6.1.

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.