[Okular-devel] [okular] [Bug 266739] okular ignores the printer settings

t_d_l_c at gmx.de t_d_l_c at gmx.de
Fri Nov 28 11:47:41 UTC 2014


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

--- Comment #3 from t_d_l_c at gmx.de ---
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list