All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Meixner <jsmeix@suse.de>
To: Open Printing <printing-architecture@lists.linux-foundation.org>
Subject: Re: Qt issue with printing landscape-oriented images
Date: Wed, 26 Feb 2025 13:24:36 +0100	[thread overview]
Message-ID: <bc3c37115c298000e7ea32ede904fb15@suse.de> (raw)
In-Reply-To: <c4066f25-c650-4037-9bce-864940daf3fa@redhat.com>


Hello,

I didn't check any details here
so only a side note for the fun of it:

There is no such thing as "landscape printing".

Cf.
https://en.opensuse.org/SDB:Landscape_Printing


On 2025-02-26 10:25, Zdenek Dohnal wrote:
> Hi Alex,
> 
> thank you for heads-up!
> 
> To be honest I have never seen IPP attribute landscape  :D - I know
> there is IPP attribute 'orientation-requested' which is used for
> setting whether you want portrait, landscape, etc.
> 
> Based on the code for image it looks like landscape is really a thing,
> and if okular wants to do landscape this way, it should pass
> landscape=true instead of false.
> 
> The older cups-filters ignores anything besides landscape=true, but
> the current libcupsfilters sets "auto-rotate" if landscape=false is
> passed, which looks correct to me.
> 
> 
> Zdenek
> 
> On 2/18/25 15:18, Alexander Pevzner wrote:
>> Hi!
>> 
>> This information may be interesting for printing stack maintainers
>> of various Linus distros (Zdenek?).
>> 
>> I've already posted it into the OpenPrinting Telegram group,
>> but as not everybody subscribed to the group, I repost it here,
>> by Till's advise.
>> 
>> We've recently noticed, that the Okular (Qt-based image viewer)
>> incorrectly prints images in the landscape orientation.
>> 
>> When printing image (see attached test.png) it sends the
>> following Create-Job request, followed by the image,
>> converted to PDF (see attached 00000020-data.pdf:
>> 
>> -----
>> IPP: request message:
>> {
>>     VERSION 2.0
>>     OPERATION Create-Job
>> 
>>     GROUP operation-attributes-tag
>>     ATTR "attributes-charset" charset: utf-8
>>     ATTR "attributes-natural-language" naturalLanguage: en-us
>>     ATTR "printer-uri" uri: 
>> ipp://localhost/printers/Kyocera_ECOSYS_M2040dn
>>     ATTR "requesting-user-name" nameWithoutLanguage: pzz
>>     ATTR "job-name" nameWithoutLanguage: bug.png
>> 
>>     GROUP job-attributes-tag
>>     ATTR "media" keyword: A4
>>     ATTR "sides" keyword: one-sided
>>     ATTR "landscape" boolean: false
>>     ATTR "number-up" integer: 1
>>     ATTR "number-up-layout" keyword: lrtb
>>     ATTR "job-billing" nameWithoutLanguage:
>>     ATTR "job-priority" integer: 50
>>     ATTR "job-sheets" nameWithoutLanguage: none none
>> }
>> -----
>> 
>> It can be reduced down to the very simple Qt example:
>> 
>> -----
>> #include <iostream>
>> #include <QApplication>
>> #include <QPrinter>
>> #include <QPrintDialog>
>> #include <QImage>
>> #include <QPainter>
>> 
>> int main(int argc, char* argv[])
>> {
>>     QApplication app(argc, argv);
>>     QPrinter printer;
>>     printer.setPageOrientation(QPageLayout::Landscape);
>>     QImage img("./test.png");
>>     img = img.scaled(printer.width(), printer.height(), 
>> Qt::KeepAspectRatio, Qt:
>>     QPainter painter(&printer);
>>     painter.drawImage(0, 0, img, 0, 0);
>>     painter.end();
>>     return 0;
>> }
>> -----
>> 
>> The problem is obviously in the ATTR "landscape" boolean: false
>> attribute. This is definitely at the Qt side. Seems like all
>> existing versions of Qt are affected.
>> 
>> We have submitted PR agains qt-base, it is pretty trivial
>> and currently on review:
>> 
>> https://codereview.qt-project.org/c/qt/qtbase/+/624835
>> 
>> I believe, all more or less modern Linux distros are affected
>> and wonder why nobody complained before
>> 
>> Note, the problem doesn't exist with old versions of the
>> cups-filters (I was able to test with very old version1.28)
>> 
>> Looks like the landscape attribute attribute is silently ignoring
>> by these old versions, and without this explicit orientation setting,
>> filters set correct orientation automatically.
>> 

Kind Regards
Johannes Meixner
-- 
SUSE Software Solutions Germany GmbH
Frankenstr. 146 - 90461 Nuernberg - Germany
(HRB 36809, AG Nuernberg) GF: Ivo Totev

  reply	other threads:[~2025-02-26 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18 14:18 Qt issue with printing landscape-oriented images Alexander Pevzner
2025-02-26  9:25 ` Zdenek Dohnal
2025-02-26 12:24   ` Johannes Meixner [this message]
2025-02-28 21:40   ` Alexander Pevzner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc3c37115c298000e7ea32ede904fb15@suse.de \
    --to=jsmeix@suse.de \
    --cc=printing-architecture@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.