Bug 422626 - Allow multiple pages ranges to print in Okular on Windows
Summary: Allow multiple pages ranges to print in Okular on Windows
Status: CONFIRMED
Alias: None
Product: okular
Classification: Applications
Component: printing (show other bugs)
Version: 1.9.2
Platform: Microsoft Windows Other
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-08 12:12 UTC by Xavier Guillot
Modified: 2021-04-30 07:47 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Print dialog (32.71 KB, image/png)
2020-06-08 12:12 UTC, Xavier Guillot
Details
Error message on Windows (34.73 KB, image/png)
2020-06-09 07:44 UTC, Xavier Guillot
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xavier Guillot 2020-06-08 12:12:27 UTC
Created attachment 129136 [details]
Print dialog

Hi,

Since a long time I wondered why Okular didn't allow to select specific pages ranges to print only a part of a document, in addition to the "From page ... to page ..."

In the 1.9 version, I saw the option available, but it only allows one range : if I want for example print pages 1-10;14-15;25;32-45;50-65 from a document, I have to do it as many times as there are different ranges, which is a little constraining.

The screenshot provided comes from the 1.9.2 version of Okular on Windows Store.

Would it be please possible to add the ability to print specific ranges, as in many other softwares ?

It is marked as fixed in Qt but I still have the problem...

https://bugs.kde.org/show_bug.cgi?id=374807

Thanks !
Comment 1 Albert Astals Cid 2020-06-08 17:38:24 UTC
You're writing the ranges wrong.

See the tooltip for how to write them correctly.

Ah wait, this is windows?

I've no idea then, sorry.

Please next time fill in Platform correctly.
Comment 2 Jack 2020-06-08 17:47:04 UTC
My French may be rusty, but it looks like the instructions in the screen-shot specifically say a page number or one range of pages.  I don't know if that is a limitation in the Windows build of Okular, or in the Windows PDF printer driver.
Comment 3 Albert Astals Cid 2020-06-08 20:09:47 UTC
The tooltip explains how to do it on the Linux version. Sorry if my previos comment wasn't clear
Comment 4 Xavier Guillot 2020-06-08 20:53:17 UTC
Right, I just tested in on Linux Ubuntu (20.04).

If I put "," instead of ";" to separate the ranges, I don't get the error message - I'll check again tomorrow if it's the same on Windows, I think I tried and got the error but I'm not sure.

But on Linux, if I try to print on a file, whatever selection I put, even 1 range or one unique page, it always prints the whole document. If I select the option "Current page", it prints only this one. Same with the option "Print from page XX to page XX", it prints only the good range.

On Evince, the print on file works well with the chosen ranges, so it's specific to Okular...
Comment 5 Jack 2020-06-08 22:53:00 UTC
I finally tested both.  On Windows (package is 19.12.2, help/about says 1.9.2) the print dialog explicitly says to enter single page or single page range.  As in Comment 2, I don't know if this is an Okular on Windows limitation, or something inherent to the Windows print system.

On Linux (About says 1.9.3, but package says 19.12.3) I confirm that requesting pages "1,49-50,99" still printed the entire document.
Comment 6 Xavier Guillot 2020-06-09 07:44:17 UTC
Created attachment 129155 [details]
Error message on Windows

Hi,

I confirm that, on Windows, even with ranges defined with the comma, it asks to enter only one range.

And error is also for printing on a physical device, not only on a pdf file.
Comment 7 Nate Graham 2020-06-11 05:06:14 UTC
Seems like a limitation of the Windows Qt print dialog. I guess we could make the tooltip only show that information on Linux.
Comment 8 Jack 2020-06-11 17:08:49 UTC
There are two separate issues here.

1) Windows only allows a single page or range, Linux allows multiple.  (MacOS?) That limit seems clear to me from the note on the print dialog.  If the limitation is really in the Windows Qt print dialog, the should be raised as a Qt bug or enhancement request.

2) On Linux, selecting multiple pages/ranges does not work - the entire file gets printed.  This is not platform specific, and seems to be a real bug.  What other information can be provided to help confirm and fix?
Comment 9 Bernie Innocenti 2021-02-13 02:57:49 UTC
> But on Linux, if I try to print on a file, whatever selection I put, even 1 range or one unique page, it always prints the whole document.

Confirmed, both in Okular and Kate: the whole document is printed, no matter what you type in the pages input box

Steps to reproduce:

1. Open a multi-page PDF in Okular
2. Select Print
3. Select Print to File
4. Open "Options >>"
5. Select Pages in the Print Range tab
6. Type "2" in the adjacent input box 
7. Click Print
8. Open the output PDF: all pages have been printed :-(

This happens also with a range ("2-3") and also in Kate (so the component should be changed to some framework?)
Comment 10 Bernie Innocenti 2021-04-28 16:40:55 UTC
(In reply to Bernie Innocenti from comment #9)
> This happens also with a range ("2-3") and also in Kate (so the component
> should be changed to some framework?)

The correct component is probably Qt:
https://invent.kde.org/qt/qt/qtbase/-/blob/dev/src/printsupport/dialogs/qprintdialog_unix.cpp#L820

A similar bug was fixed in Qt long ago:
https://bugreports.qt.io/browse/QTBUG-77351

The commit message of the fix reads:

  Unix: Disable complex page ranges widget when printing to pdf

  It doesn't work since it relies on cups to do the heavy lifting and cups
  is not used when printing to PDF

The code is still present in the Qt 5.15 branch:

  // Disable complex page ranges widget when printing to pdf
  // It doesn't work since it relies on cups to do the heavy lifting and cups
  // is not used when printing to PDF
  options.pagesRadioButton->setEnabled(outputFormat != QPrinter::PdfFormat);

Yet, the radio button remains enabled for me. So perhaps it's not working as intended.
Comment 11 Albert Astals Cid 2021-04-28 20:40:59 UTC
Just wnat to clarify that qprintdialog_unix.cpp is not used in Windows, and thus any issue in that file does not apply at all here (after all this is a Windows bug)
Comment 12 Bernie Innocenti 2021-04-29 01:21:46 UTC
(In reply to Albert Astals Cid from comment #11)
> Just wnat to clarify that qprintdialog_unix.cpp is not used in Windows, and
> thus any issue in that file does not apply at all here (after all this is a
> Windows bug)

comment #8 lists at two separate problems. I'm investigating this one:

> 2) On Linux, selecting multiple pages/ranges does not work - the entire file
> gets printed.  This is not platform specific, and seems to be a real bug.
> What other information can be provided to help confirm and fix?

Happy to file a separate KDE bug for this, but both bugs seem to be in Qt5.
Comment 13 Albert Astals Cid 2021-04-29 18:43:21 UTC
(In reply to Bernie Innocenti from comment #12)
> (In reply to Albert Astals Cid from comment #11)
> > Just wnat to clarify that qprintdialog_unix.cpp is not used in Windows, and
> > thus any issue in that file does not apply at all here (after all this is a
> > Windows bug)
> 
> comment #8 lists at two separate problems. I'm investigating this one:
> 
> > 2) On Linux, selecting multiple pages/ranges does not work - the entire file
> > gets printed.  This is not platform specific, and seems to be a real bug.
> > What other information can be provided to help confirm and fix?
> 
> Happy to file a separate KDE bug for this, but both bugs seem to be in Qt5.

If the bug original is about windows, adding a random bug to it just makes both bugs now harder to fix, so yes, if it is a different bug, open a new bug.
Comment 14 Bernie Innocenti 2021-04-30 04:15:00 UTC
Ok, I changed the bug topic to specifically refer to Windows. Two questions:

 - Could the original reporter please confirm that the bug is still present?
 - Okular isn't the only affected application. Which component should be used in bugs.kde.org to track upstream Qt bugs?
Comment 15 Bernie Innocenti 2021-04-30 04:27:19 UTC
I filed bug #436388 to track the Linux issue separately.
Comment 16 Xavier Guillot 2021-04-30 07:47:29 UTC
Yes, I confirm that the bug is still present with Okular 20.12.2 on Windows 10. Thanks for the verification work and separate bug filled for Linux !