Bug 408270 - Okular always prints in A4 on physical printers, even when Letter is the default
Summary: Okular always prints in A4 on physical printers, even when Letter is the default
Status: RESOLVED UPSTREAM
Alias: None
Product: okular
Classification: Applications
Component: printing (show other bugs)
Version: 1.7.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 406237 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-06-04 01:41 UTC by Matthew Trescott
Modified: 2019-07-10 20:53 UTC (History)
2 users (show)

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


Attachments
The PPD for my printer (9.45 KB, application/gzip)
2019-06-04 01:44 UTC, Matthew Trescott
Details
Sample PDF used (9.03 KB, application/pdf)
2019-06-04 01:45 UTC, Matthew Trescott
Details
Output from /var/spool/cups (28.45 KB, application/postscript)
2019-06-04 01:51 UTC, Matthew Trescott
Details
file in /var/spool/cups/ generated by Okular with dummy printer using same PPD (28.41 KB, application/postscript)
2019-06-06 07:18 UTC, Michael Weghorn
Details
CUPS log when printing (3.75 KB, text/plain)
2019-07-06 14:37 UTC, Matthew Trescott
Details
CUPS error log when printing with LibreOffice (12.14 KB, text/plain)
2019-07-06 16:22 UTC, Matthew Trescott
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Trescott 2019-06-04 01:41:39 UTC
Split from https://bugs.kde.org/show_bug.cgi?id=406237

I turned off WiFi temporarily so
CUPS would hold my print job (it's a network printer), then printed my
Letter-size PDF. I double-checked the printer properties in Okular to make
sure that it was set to Letter (Letter is the default for the print queue
so the paper size was already correctly set). However, when I opened the
corresponding PostScript document in /var/spool/cups, it had the distinctive
sqrt(2) side ratio of A-size paper. This confirms the results I had when I
permitted the print jobs to go through previously and discovered this bug---I
just didn't want to waste paper this time.

Attachments are coming shortly.

System: 
Arch Linux (fairly up-to-date)
CUPS 2.2.11
Comment 1 Matthew Trescott 2019-06-04 01:44:24 UTC
Created attachment 120540 [details]
The PPD for my printer

This is the PPD for the printer I use. It is a Samsung C1860FW laser printer. The PPD is from /usr/share/foomatic/db/source/PPD/Samsung
Comment 2 Matthew Trescott 2019-06-04 01:45:10 UTC
Created attachment 120541 [details]
Sample PDF used

This is the sample PDF I printed.
Comment 3 Matthew Trescott 2019-06-04 01:51:40 UTC
Created attachment 120542 [details]
Output from /var/spool/cups
Comment 4 Matthew Trescott 2019-06-04 01:52:32 UTC
Note that this doesn't occur with other software like LibreOffice, so I don't think it's a problem with CUPS or the PPD.
Comment 5 Matthew Trescott 2019-06-04 01:57:05 UTC
Also note that this bug is unaffected by the scaling settings available when "Force rasterization" is selected.
Comment 6 Michael Weghorn 2019-06-04 06:39:23 UTC
*** Bug 406237 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2019-06-05 15:49:42 UTC
Hmm, on Manjaro (i.e. fairly Arch-like) I cannot reproduce on my printer, an HP LaserJer P1606DN. The provided PDF file prints correctly for me.
Comment 8 Michael Weghorn 2019-06-06 07:18:21 UTC
Created attachment 120617 [details]
file in /var/spool/cups/ generated by Okular with dummy printer using same PPD

I cannot reproduce on Debian testing (okular 4:17.12.2-2.2, poppler 0.71.0-5) with a dummy printer set up with the same PPD, s. attached file that Okular generates for printing in my case, which is Letter.
Comment 9 Michael Weghorn 2019-06-06 07:20:46 UTC
What Poppler version do you have?

Can you increase CUPS log level ('LogLevel debug' in /etc/cups/cupsd.conf), restart CUPS and attach the resulting CUPS log ( /var/log/cups/error/log ; or relevant parts of it ) when printing again?
Comment 10 Bug Janitor Service 2019-06-21 04:33:08 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 11 Bug Janitor Service 2019-07-06 04:33:09 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 12 Matthew Trescott 2019-07-06 14:37:15 UTC
I have Poppler 0.76. I'll attach the relevant CUPS log shortly.
Comment 13 Matthew Trescott 2019-07-06 14:37:55 UTC
Created attachment 121352 [details]
CUPS log when printing
Comment 14 Matthew Trescott 2019-07-06 14:42:31 UTC
Sorry for the spam, it's actually poppler 0.76.1.
Comment 15 Michael Weghorn 2019-07-06 15:58:54 UTC
(In reply to Matthew Trescott from comment #13)
> Created attachment 121352 [details]
> CUPS log when printing

This log (s. the 'argv[5]' line) shows that A4 is explicitly set for the page size. This shouldn't happen if you have Letter selected in the print dialog, and as mentioned, I couldn't reproduce with the same PPD.

Is there any file /etc/cups/lpoptions or $HOME/.cups/lpoptions present, and if so, can you attach them here (or try to delete them and see what happens then)?
Comment 16 Matthew Trescott 2019-07-06 16:22:31 UTC
Created attachment 121353 [details]
CUPS error log when printing with LibreOffice

No, neither of those files exist. And as I said, LibreOffice doesn't have this problem. Here's the CUPS error log when printing with LibreOffice (I included a bit more at the beginning this time)

I noticed that LibreOffice sends CUPS a PDF, while Okular sends CUPS a PostScript file. Maybe something goes wrong in the PDF -> PostScript conversion in Okular/Poppler?
Comment 17 Michael Weghorn 2019-07-06 20:04:21 UTC
(In reply to Matthew Trescott from comment #16)
> Created attachment 121353 [details]
> CUPS error log when printing with LibreOffice
> 
> No, neither of those files exist. And as I said, LibreOffice doesn't have
> this problem. Here's the CUPS error log when printing with LibreOffice (I
> included a bit more at the beginning this time)

Indeed, this log has "PageSize=Letter" as expected.

> 
> I noticed that LibreOffice sends CUPS a PDF, while Okular sends CUPS a
> PostScript file. Maybe something goes wrong in the PDF -> PostScript
> conversion in Okular/Poppler?

I think the problem is earlier already, since the wrong value of the option is used, so I'd expect that Poppler is passed A4 already and thus generates A4 (as it's told).

What happens with other Qt/KDE applications, like e.g. Kate?
Comment 18 Matthew Trescott 2019-07-08 22:24:11 UTC
Same problem happens with Kate. :/
Comment 19 Michael Weghorn 2019-07-09 05:59:12 UTC
(In reply to Matthew Trescott from comment #18)
> Same problem happens with Kate. :/

... in which case this isn't Okuklar's fault, but seems somewhat related to the Qt print dialog in general. What Qt version do you have?

Can we close this bug as RESOLVED UPSTREAM (since Qt has it's own issue tracker at [1])?

Feel free to continue commenting, though, even if the bug is closed.
However, unless you have an old Qt version (which seems to be unlikely since you mention you're using Arch), I'm running out of ideas...

[1] http://bugreports.qt.io/
Comment 20 Matthew Trescott 2019-07-10 00:18:49 UTC
Qt 5.13.0. I filed a bug upstream: https://bugreports.qt.io/browse/QTBUG-76982
Comment 21 Michael Weghorn 2019-07-10 20:53:19 UTC
(In reply to Matthew Trescott from comment #20)
> Qt 5.13.0. I filed a bug upstream:
> https://bugreports.qt.io/browse/QTBUG-76982

Thanks! Closing this bug report then.