Bug 492957 - Text annotations with a zero-area bounding box can not be opened (no pop up).
Summary: Text annotations with a zero-area bounding box can not be opened (no pop up).
Status: RESOLVED NOT A BUG
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 23.08.5
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-10 19:53 UTC by ederag
Modified: 2024-09-16 20:41 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
File generated by LibreOffice Impress with a comment (14.88 KB, application/pdf)
2024-09-10 19:53 UTC, ederag
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ederag 2024-09-10 19:53:35 UTC
Created attachment 173539 [details]
File generated by LibreOffice Impress with a comment

Annotations with a zero-area bounding box
(x_min == x_max  || y_min == ymax)
seem impossible to open in okular.


As an example, please find attached
a PDF generated by LibreOffice Impress (a single page with some text and a comment below).

I understand their idea: the reader is then allowed to choose the most appropriate area
where the mouse should hover to popup the comment
(for instance it could match the icon marking the comment presence).

That's why it is tentatively reported here.
If the okular devs have counter-arguments, I'd be glad to hear
and turn the discussion to LibreOffice, of course.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Leap 15.6
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12 

ADDITIONAL INFORMATION

Here is the line with the annotation bounding box in the PDF:
<</Type /Annot /Subtype /Text /BS<</W 0>>/Rect[355.124 303.221 355.124 303.221] /Popup 9 0 R /M

Increasing both xmax and ymax (say by 10.0) in a text editor allow to popup the comment normally in okular.
Comment 1 Albert Astals Cid 2024-09-12 10:04:53 UTC
You can open it from the annotations sidebar?
Comment 2 ederag 2024-09-12 12:28:34 UTC
(In reply to Albert Astals Cid from comment #1)
> You can open it from the annotations sidebar?

Yes, it is readable in the annotation sidebar.
Comment 3 Albert Astals Cid 2024-09-12 14:34:01 UTC
Then that's how you handle malformed documents.
Comment 4 ederag 2024-09-14 08:39:13 UTC
OK, reported to libreoffice then:
https://bugs.documentfoundation.org/show_bug.cgi?id=162955
Comment 5 ederag 2024-09-16 15:46:48 UTC
Excerpt from this answer (https://bugs.documentfoundation.org/show_bug.cgi?id=162955#c2) from libreoffice:
> Can't test Okular or other poppler based PDF viewers. But not sure I'd agree this is a malformed PDF.

And from https://bugs.documentfoundation.org/show_bug.cgi?id=162955#c4
> Yes, get a pop-up on mouseover in each of them [chrome, edge and reader].

WIth okular on windows, they find that a popup can appear, but one has to "hunt" for the right position.
Comment 6 ederag 2024-09-16 16:06:09 UTC
Looking for the specs there
https://pdfa.org/resource/pdf-specification-archive/
which links to
https://web.archive.org/web/20080624230300/http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference_1-7.pdf

> BBox: rectangle
> (Optional for Annot; required for any figure or table appearing in its entirety on
> a single page; not inheritable). An array of four numbers in default user space
> units giving the coordinates of the left, bottom, right, and top edges, respec-
> tively, of the element’s bounding box (the rectangle that completely encloses
> its visible content). This attribute applies to any element that lies on a single
> page and occupies a single rectangle.

I searched the spec, and nothing seems to prevent a zero-area bounding box.
Rationale: the viewer then gets to choose the appropriate hover area.
Comment 7 Albert Astals Cid 2024-09-16 20:41:16 UTC
That quote you are linking has nothing to do with what we're speaking here.

This is is the rectangle defined for that annotation in the file you have attached
  /Rect [355.124 303.221 355.124 303.221]
i.e the rect is 0x0 sized. 

And this is the documentation for Rect

"(Required) The annotation rectangle, defining the location of the annotation on the page in default user space units."

Yes, the annotation rectangle being 0x0 is not strictly malformed, but I don't see where you see "the viewer then gets to choose the appropriate hover area." I don't think we get to choose, we were told exactly the area by the creator of the PDF and that area is 0x0.