Bug 483914 - When printing, selecting a manually-typed page number or range of pages causes nothing to be printed
Summary: When printing, selecting a manually-typed page number or range of pages cause...
Status: RESOLVED UPSTREAM
Alias: None
Product: okular
Classification: Applications
Component: printing (other bugs)
Version First Reported In: 24.02.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL: https://codereview.qt-project.org/c/q...
Keywords: qt6
: 485380 488361 490435 502236 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-03-18 16:47 UTC by DA4PKol
Modified: 2025-06-19 04:18 UTC (History)
8 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DA4PKol 2024-03-18 16:47:47 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Open a multi-pages pdf
2. Set a range in options (let’s say 2-3)
3. Print 

OBSERVED RESULT
Nothing is printed. 


EXPECTED RESULT
Selected pages of the pdf printed.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
Operating System: Arch Linux 
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.1-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 32 × 13th Gen Intel® Core™ i9-13900HX
Memory: 31.1 Gio of RAM
Graphics Processor: Mesa Intel® Graphics

ADDITIONAL INFORMATION
This is happening with a fresh install of Arch Linux / Plasma 6 and on two different printers (Oki MB-472 and Epson XP-15000). Okular can print the first page, the whole pdf, but not a single page or a range of pages inside the pdf. 
Cups error_log simply reports 'Backend ipp returned status 5 (cancel job)". Other app (like xpdf) print well.

Regards, SW.
Comment 1 John Kizer 2025-04-10 18:08:24 UTC
*** Bug 502236 has been marked as a duplicate of this bug. ***
Comment 2 John Kizer 2025-04-10 18:10:46 UTC
I can reproduce this on Okular 24.12.3, Frameworks 6.12.0, Qt 6.8.2.
Comment 3 Roman Karwacik 2025-04-14 14:28:25 UTC
Thank you for merging. What's important for reproducing this issue is that the "Pages" option is the one affected, the "Pages from" option seems to work fine.

It seems like with the Okular is cropping the pages according to the specification on the "Pages" input first, and is additionally sending the page-ranges on the IPP level, which does not make sense in this context, as after cropping the page numbers have changed.
Comment 4 John Kizer 2025-04-28 19:11:59 UTC
*** Bug 485380 has been marked as a duplicate of this bug. ***
Comment 5 John Kizer 2025-05-11 06:21:45 UTC
*** Bug 490435 has been marked as a duplicate of this bug. ***
Comment 6 John Kizer 2025-05-11 06:23:04 UTC
*** Bug 488361 has been marked as a duplicate of this bug. ***
Comment 7 kolAflash 2025-06-09 14:33:52 UTC
I observe very similar behavior in Okular, where often a page is missed. And I think it's probably the same bug, so I add it here.

.

The behavior is quite irregular, but it's deterministic. Some examples:

print page 1: prints page 1

print page 2: prints no pages

printing page 2-3 or 2,3: prints page 3

printing page 2-4 or 2,3,4: prints pages 3 + 4

printing page 3-4 or 3,4: prints no pages

.

Used for testing:
https://files.kde.org/neon/images/unstable/20250608-1147/neon-unstable-20250608-1147.iso
KDE-6.4.80, Okular-25.04
apt update; apt install printer-driver-cups-pdf
Printer name in Okular printing UI: PDF
It's reproducible with all my real printers, like an "HP DeskJet 1000 j110". But this one's the easiest for testing.
Only difference between cups-pdf and a real printer is, that when a real prints just prints nothing (0 pages), then cups-pdf will generate a blank page.

.

The KDE internal PDF printer can't be used for testing, because it only prints the whole documents.
bug 436388: Printing page ranges doesn't work with "Print to File (PDF)"

Maybe related:
bug 427241: page number mapped wrong

Workaround:
Use another PDF viewer like Gnome's Document Viewer "Evince". This works fine on the same system, which is another indicator that this is really a KDE bug.
Comment 8 kolAflash 2025-06-09 14:36:17 UTC
P.S.
Used PDF for testing:
https://files.kde.org/neon/images/unstable/20250608-1147/neon-unstable-20250608-1147.iso
/usr/share/doc/shared-mime-info/shared-mime-info-spec.pdf
Comment 9 kolAflash 2025-06-09 20:35:09 UTC
Other KDE applications are also broken. So this probably originates in a KDE library.

# Kate
// bash (73 lines are one A4, 9pt "Hack" font page)
for i in {1..5}; do for j in {101..173}; do echo "${i} ${j}"; done; done >> test.txt
// open with Kate and print page 2 via "Pages" input field => prints nothing (or empty page)

.

This Qt6 commit (2025-03-23) may possibly fix it:

rely on CUPS for multiple page ranges in unix version of QPrintDialog
[...]Restore the behavior of Qt5 [...]
[...]Pick-to: 6.9 6.8[...]
https://github.com/qt/qtbase/commit/2428cbf44e3e2aa4eaf00c9548ac5a74685101c4
in tag 6.9.1 (not in 6.9.0)
probably in future tag 6.8.4 (not in 6.8.3)

https://files.kde.org/neon/images/unstable/20250608-1147/neon-unstable-20250608-1147.iso
=> Qt-6.9.0

Okular code hint:
https://invent.kde.org/graphics/okular/-/blob/4abf50580bcb8595b63d139d91708e0015b7b6ce/generators/poppler/generator_pdf.cpp#L1513

.

Some affected distros: Debian-13 (KDE-6.3.4), Kubuntu-24.10 (KDE-6.1.5)

Hint: cups-pdf output seems to default to ~/PDF/
Comment 10 John Kizer 2025-06-19 04:18:51 UTC
Hi folks - I can no longer reproduce these issues after upgrading to Qt 6.9.1 - given the merging of this code into the upstream project, it seems to make sense that it would positively impact this issue: https://codereview.qt-project.org/c/qt/qtbase/+/633938

There is another issue that I can still reproduce related to the "Pages" entry when printing, but that concerns a general issue with printing multiple pages per sheet: https://bugs.kde.org/show_bug.cgi?id=432258