Bug 162955 - In the exported PDF comments are annotations with zero area bounding box
Summary: In the exported PDF comments are annotations with zero area bounding box
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
24.2.4.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Tibor Nagy
URL:
Whiteboard: target:25.2.0 target:24.8.2
Keywords:
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
 
Reported: 2024-09-14 08:36 UTC by edera
Modified: 2024-09-23 10:42 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Presentation with a comment (12.66 KB, application/vnd.oasis.opendocument.presentation)
2024-09-14 08:37 UTC, edera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description edera 2024-09-14 08:36:00 UTC
Description:
In the exported PDF, the comments become annotations that have a zero area
bounding box (x_min == x_max  || y_min == ymax).

This prevents their text from being read when hovering in many pdf viewers
such as okular, mupdf, and qpdfview, with the exception of firefox.


Steps to Reproduce:
Create a comment (Ctrl+Alt+C) or open the attached presentation,
then File > Export as PDF
(with "Comments as PDF annotations" checked).
Open the resulting PDF in okular, qpdfview or mupdf,
Hover the comment icon.


Actual Results:
Nothing appears, no matter where the mouse cursor is placed.

Expected Results:
The comment text should appear in a popup.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Reported to okular: https://bugs.kde.org/show_bug.cgi?id=492957
where it was said to be a "malformed document".
Comment 1 edera 2024-09-14 08:37:26 UTC
Created attachment 196435 [details]
Presentation with a comment
Comment 2 V Stuart Foote 2024-09-14 12:11:15 UTC
Verify the zero area bounding box (x_min == x_max  || y_min == ymax) of PDF comments as annotations on PDF export. But as noted FF handles positioning of the annotation without issue. Likewise Chrome, Edge, and Adobe Reader. They list the annotation, but also expose an selection icon in a correct position.

Can't test Okular or other poppler based PDF viewers. But not sure I'd agree this is a malformed PDF.

=-testing-=

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 1b61a0737e3600aadf42f28a15c70aface9ab61e
CPU threads: 8; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 3 edera 2024-09-14 18:55:14 UTC
> FF handles positioning of the annotation without issue.
> Likewise Chrome, Edge, and Adobe Reader.
> They list the annotation,
> but also expose an selection icon in a correct position.

Thanks for the answer. Like in your description,
the icon is correctly positioned in okular,
and the annotation is listed in the side bar with its text.

But this is not practical when there are several comments
(hard to tell which is related to which part of the slide).

The crucial issue is the hovering over/near the icon
that should trigger a popup with the comment text.

I guess that for the popup to appear, the mouse event
has to happen inside the bounding box,
which never happens for zero-area bounding box of course.

Does the popup appear in chrome, edge and reader as well ?
Comment 4 V Stuart Foote 2024-09-14 19:46:43 UTC
(In reply to edera from comment #3)

> Does the popup appear in chrome, edge and reader as well ?

Yes, get a pop-up on mouseover in each of them. Though the pop-up is styled differently with each.

On Windows 10 (22H2 build 18945.4894)
Acrobat Reader 2024.003.20054 - 64-bit
Chrome 128.0.6613.138 (Official Build) (64-bit)
Edge 128.0.2739.79 (Official build) (64-bit)

and on Firefox 130.0 (64-bit) as well.
Comment 5 V Stuart Foote 2024-09-14 20:03:14 UTC
Grabbed Okular for Windows 23.08.1 from the Windows Store.

In fact, this build of Okular shows a pin-in-note icon for each comment, and when moving the mouse pointer (hand while moving, but arrow pointer when over) to the upper left vicinity of that icon--each comment does pop-up. Black text strings on a framed light yellow bg. And with pop-up showing--a double mouseclick pops it open as a full on annotation post-it. 

A bit of a hunt to hit the mouse over, but Okular is placing an icon mark and pop-up of comment seems to be working for me.
Comment 6 edera 2024-09-16 16:18:49 UTC
Thanks a lot for testing with others viewers.
Passed the info to the okular devs
https://bugs.kde.org/show_bug.cgi?id=492957#c5

Nothing explicitly prevents zero-area bounding bow in the PDF-1.7 specs
https://bugs.kde.org/show_bug.cgi?id=492957#c6

I'd close this as "Not our bug" then.

About the previous comment (https://bugs.documentfoundation.org/show_bug.cgi?id=162955#c5):
I did try again with okular on linux,
and neither hovering the corner nor double click on the icon worked.
either I failed to find the right pixel (on a 2560x1440 screen),
or the platform makes things worse.
Anyway, having to hunt for the popup looks bad
(frustrating + it hurts discovery)
Comment 7 Commit Notification 2024-09-19 06:59:53 UTC
Tibor Nagy committed a patch related to this issue.
It has been pushed to "master":

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

tdf#162955 PDF export: avoid the popup rectangle with zero size

It will be available in 25.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 8 edera 2024-09-22 19:45:24 UTC
Thanks for the patch, it works fine.

Tested with the latest nightly
(LibreOfficeDev_25.2.0.0.alpha0_Linux_x86-64_deb.tar.gz)
in an ubuntu-24.04LTS virtualbox, opened with evince.
(it had the same issue as okular).
Comment 9 Commit Notification 2024-09-23 10:42:49 UTC
Tibor Nagy committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/8a96b29b6b6c78ae5021115694f9818a64387aeb

tdf#162955 PDF export: avoid the popup rectangle with zero size

It will be available in 24.8.2.

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.