https://bugs.documentfoundation.org/show_bug.cgi?id=173026
Bug ID: 173026
Summary: Calc: PDF export misplaces link annotation of a cell
URL text field to the top-left page corner (link
target and tooltip lost)
Product: LibreOffice
Version: 26.2.4.2 release
Hardware: Other
OS: Linux (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Printing and PDF export
Assignee: [email protected]
Reporter: [email protected]
Description:
When a Calc cell contains a `com.sun.star.text.TextField.URL` inside its
text (inserted e.g. via Insert > Hyperlink, or via the API/a Basic macro
using `insertTextContent`), exporting the sheet to PDF places the
resulting `/Link` annotation's `/Rect` at a fixed position in the
top-left corner of the page instead of over the visible text. The link
target itself (`/Dest`) stays correct, but the clickable area no longer
covers the text, so the link is effectively unusable in the exported
PDF. The `/Contents` (tooltip) of the annotation is also lost.
This is a regression: LibreOffice 24.2 places the same annotation
correctly, directly over the cell text.
A `=HYPERLINK()` formula in a cell, and a URL text field inside a
floating text box (`com.sun.star.drawing.TextShape`), are NOT affected —
both keep the correct position in 26.2.4.2. Only the URL text field
inside a spreadsheet cell's text is affected. This also affects
external (http/https) targets, not just internal document jumps.
Steps to Reproduce:
1. Open the attached `tdf_repro_url_textfield_link.ods` in Calc.
2. Go to Sheet1, cell A5, which contains a cell URL text field reading
"Click here to jump to Sheet2" (target: `#$'Sheet2'.A1`).
Cell A7 contains the same target via a `=HYPERLINK()` formula, for
comparison.
3. File > Export As > Export as PDF... > Export (default settings,
Range: All).
4. Open the resulting PDF and inspect the link annotations, e.g. with
`pypdf`/`PyPDF2`:
```python
from pypdf import PdfReader
r = PdfReader("output.pdf")
for p in r.pages:
for a in (p.get("/Annots") or []):
o = a.get_object()
if o.get("/Subtype") == "/Link":
print(o.get("/Rect"), o.get("/Contents"))
```
(Visually: try clicking the link text in a PDF viewer — nothing
happens because the clickable area is not there.)
Actual Results:
For the cell URL text field (A5): the `/Rect` of the `/Link` annotation
is placed in the top-left corner of the page
(e.g. `[-0.3, 583.9, 59.4, 595.5]` on a page of height 595.3pt — note
the rectangle even extends slightly outside the page). `/Contents` is
absent. The link is not clickable where the visible text is.
For the `=HYPERLINK()` formula (A7): the `/Rect` correctly covers the
visible text.
Expected Results:
The `/Rect` of the link annotation for the cell URL text field should
cover the visible text, the same way it does for the `HYPERLINK()`
formula, and the same way LibreOffice 24.2 exports it.
Reproducible: Always
User Profile Reset: No
Additional Info:
Discovered while building an internal reporting spreadsheet with
cross-references between two areas of the same document (~120 such
links). Reference PDF exported with LibreOffice 24.2 is attached
(`tdf_repro_reference_LO24.2.pdf`) — the same .ods, link rectangle
correctly on the text. A larger real-world test file with five
different linking techniques (cell URL text field internal, cell URL
text field external, `HYPERLINK()` formula, floating text box with URL
field, shape with Hyperlink property) is attached as supplementary
evidence (`Sprungmarken_Test.ods` + the corresponding PDF exported with
26.2.4.2, `Sprungmarken_Test_LO26.2.4.2.pdf`): it shows the same corner
placement for both cell-text-field variants (internal and external
target), while the formula and the text-box variant remain correct in
26.2.4.2, and the shape-with-Hyperlink variant produces no annotation
at all in either version.
Version tested for "actual results": LibreOffice 26.2.4.2 (X86_64),
Linux (reported independently on two separate Linux installations).
Version tested for "expected results": LibreOffice 24.2.7.2
420(Build:2), Linux.
--
You are receiving this mail because:
You are the assignee for the bug.