Commit deb6c55e authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Make kpdf forward to kprinter the page orientation. That needs testing but it works for me (TM)

The printer.setOption("orientation-requested", "4"); to request Landscape when using a preview and not doing printer.setup() is really an undocumented feature of kprinter as printer.setOrientation(KPrinter::Landscape); only seems to work if you use kprinter::setup and set if BEFORE using that method

svn path=/trunk/kdegraphics/kpdf/; revision=343832
parent 935003c0
......@@ -577,13 +577,20 @@ Part::print()
if (m_doc == 0)
return;
double width, height;
KPrinter printer;
printer.setPageSelection(KPrinter::ApplicationSide);
printer.setMinMax(1, m_doc->getNumPages());
printer.setCurrentPage(m_currentPage);
printer.setMargins(0, 0, 0, 0);
// TODO what if some pages are landscape and others are not?
width = m_doc->getPageWidth(1);
height = m_doc->getPageHeight(1);
if (m_doc->getPageRotate(1) == 90 || m_doc->getPageRotate(1) == 270) qSwap(width, height);
if (width > height) printer.setOrientation(KPrinter::Landscape);
if (printer.setup(widget()))
{
doPrint( printer );
......@@ -709,10 +716,19 @@ void Part::printPreview()
if (m_doc == 0)
return;
double width, height;
KPrinter printer;
printer.setMinMax(1, m_doc->getNumPages());
printer.setPreviewOnly( true );
printer.setMargins(0, 0, 0, 0);
// TODO what if some pages are landscape and others are not?
width = m_doc->getPageWidth(1);
height = m_doc->getPageHeight(1);
if (m_doc->getPageRotate(1) == 90 || m_doc->getPageRotate(1) == 270) qSwap(width, height);
if (width > height) printer.setOption("orientation-requested", "4");
doPrint(printer);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment