Version: 0.10.4 OS: Linux when printing a pdf-document, which is shown on the screen in lanscape format, the information in the printer dialog shows selection of portrait, but the printed page is in landscape. When i choose landscape in the printer dialog, the printed page is in portrait. Reproducible: Always OS: Linux (i686) release 2.6.34.8-13-desktop Compiler: gcc
I can confirm this bug for our build of okular (I work for the city of munich). We have Okular 0.18.2 and KDE 4.12.2 on our Ubuntu12LTS - based OS. I have only one pdf with which I can reproduce the bug. I think the diffence to other pdfs is that in the pdf source code there is a rotation defined - Rotate 90: 4 0 obj <</Type/Page/MediaBox [0 0 595 842] /Rotate 90/Parent 3 0 R /Resources<</ProcSet[/PDF /ImageC /ImageI /Text] /ColorSpace 25 0 R /ExtGState 26 0 R /XObject 27 0 R /Font 28 0 R >> /Contents 5 0 R >> endobj I will add an proposed patch soon.
Created attachment 89753 [details] patch, removes only one line
The problem is in QPrinter::Orientation Document::orientation() const in document.cpp. It swaps width and height when there is a rotation of 90/270 defined, but width and height are already swapped in Okular::Page. I've commented out the line which is causing the problem: QPrinter::Orientation Document::orientation() const { double width, height; int landscape, portrait; const Okular::Page *currentPage; // if some pages are landscape and others are not, the most common wins, as // QPrinter does not accept a per-page setting landscape = 0; portrait = 0; for (uint i = 0; i < pages(); i++) { currentPage = page(i); width = currentPage->width(); height = currentPage->height(); /* The following line is wrong, because width and height will already be swapped in the Okular::Page. * Rotation is not the rotation defined by the user in the gui for viewing, it's a property within the pdf specification. */ //if (currentPage->orientation() == Okular::Rotation90 || currentPage->orientation() == Okular::Rotation270) qSwap(width, height); if (width > height) landscape++; else portrait++; } return (landscape > portrait) ? QPrinter::Landscape : QPrinter::Portrait; } This bugfix works for me. But bare with me if this is not the best solution, you can build your own.
an patch against an old okular is not useful, please get at least okular from kde Applications 4.14 or the one from git, see if you can still reproduce the problem and if your patch still fixes it.
Ok. I have now built okular 0.21.60 from git://anongit.kde.org/okular on my ubuntu12lts-based system/KDE 4.13.2. The problem still occurs and removing the line still helps. I have also noticed that when I print something in okular from landscape to portrait using the cups-pdf-printer, the resulting pdf is opened in okular as landscape. Then you would have to turn the document in the gui to have it in landscape. On a real printer this doesn't play a role, because you turn the paper as you like it.
Created attachment 89792 [details] patch for okular 0.21.60
Albert, patch from comment #6 removes one line, would you need it on reviewboard to review it?
A reviewboard would make it easier keeping track that i need to review it. On the other hand printing bugs are really not on the top of my list, people where assholes on us enough on printing for me to decide all non printing bugs have priority over printing bugs. Sorry guys, it's not your fault, but it is how it is.
How would I reproduce this problem nowadays? My okular version from the git master does not show orientation information in the printer dialog.
(In reply to Oliver Sander from comment #9) > How would I reproduce this problem nowadays? My okular version from the git > master does not show orientation information in the printer dialog. The orientation information can be set in the print dialog under "Properties" -> "Page" (it comes from the Qt 5 print dialog). I am a colleague of "t_d_l_c" and at least for the document that was used in our case, the problem is no longer reproducible with up-to-date Okular and Poppler versions. (We just verified that the problem occurs on Kubuntu 12.04, but no longer on an up-to-date system (Ubuntu 18.04 based) with Okular from Applications 17.12). @Wolfgang Schmidt: Does your problem still occur? Could you add a sample document and a step-by-step guide to reproduce the issue in this case?
Please provide information if possible
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 set the bug status 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!
Dear Bug Submitter, 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!