Bug 501356 - Okular does not respect logical text order in PDF while selecting text
Summary: Okular does not respect logical text order in PDF while selecting text
Status: REPORTED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 23.08.5
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-11 13:41 UTC by Ahmet Sait
Modified: 2025-03-19 20:52 UTC (History)
1 user (show)

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


Attachments
Example PDF (52.27 KB, application/pdf)
2025-03-11 13:41 UTC, Ahmet Sait
Details
Okular text selection (186.88 KB, image/png)
2025-03-11 13:42 UTC, Ahmet Sait
Details
Chrome text selection (183.82 KB, image/png)
2025-03-11 13:42 UTC, Ahmet Sait
Details
Firefox text selection (191.30 KB, image/png)
2025-03-11 13:42 UTC, Ahmet Sait
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmet Sait 2025-03-11 13:41:31 UTC
Created attachment 179300 [details]
Example PDF

SUMMARY
Text selection in Okular works differently from browsers (both Firefox & Chrome). Most PDF viewer software seem to select text in the same order they logically appear inside the PDF file rather than where they are located on the page. Selecting text by positional heuristics might make sense for PDF files produced by things like scanners / OCR readers, but makes no sense for files produced by Word documents, HTML files and such.

I believe the default text selection behavior should match browsers', and the current behavior should be made available behind a configurable setting.

STEPS TO REPRODUCE
1. Open the attached PDF file.
2. Select text.

OBSERVED RESULT
Text is selected in an unknown/different order. (See attachments)

EXPECTED RESULT
Text is selected in logical order.

SOFTWARE/OS VERSIONS
OS: Kubuntu 24.04
KDE Plasma Version: 5.27.12
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13

ADDITIONAL INFORMATION
I'm not sure if this issue has to do with the PDF backend specifically or the way document viewer UI handles text selection in general.
Comment 1 Ahmet Sait 2025-03-11 13:42:05 UTC
Created attachment 179301 [details]
Okular text selection
Comment 2 Ahmet Sait 2025-03-11 13:42:24 UTC
Created attachment 179302 [details]
Chrome text selection
Comment 3 Ahmet Sait 2025-03-11 13:42:46 UTC
Created attachment 179303 [details]
Firefox text selection
Comment 4 George Fakidis 2025-03-19 20:52:18 UTC
This remains in 
Okular: 24.12.1
KDE Frameworks: 6.10.0
Qt: Using 6.8.1 and built against 6.8.1
KDE Flatpak runtime (Wayland)
Build ABI: x86_64-little_endian-lp64
Kernel: linux 6.13.4-1-default
OpenSUSE Tumbleweed.