Fix PDF orientation for ANSI B Landscape
- PDF exports in landscape orientation on ANSI B (Ledger) paper were formatted as landscape, but on portrait paper orientation.
This commit is contained in:
committed by
Yorik van Havre
parent
34d8519e62
commit
08b7e4718f
@@ -571,7 +571,12 @@ void MDIViewPage::printPdf(std::string file)
|
||||
printer.setFullPage(true);
|
||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||
printer.setOutputFileName(filename);
|
||||
printer.setOrientation(m_orientation);
|
||||
// printer.setOrientation(m_orientation);
|
||||
if (m_paperSize == QPrinter::Ledger) {
|
||||
printer.setOrientation((QPrinter::Orientation) (1 - m_orientation)); //reverse 0/1
|
||||
} else {
|
||||
printer.setOrientation(m_orientation);
|
||||
}
|
||||
printer.setPaperSize(m_paperSize);
|
||||
print(&printer);
|
||||
}
|
||||
@@ -728,8 +733,8 @@ QPrinter::PaperSize MDIViewPage::getPaperSize(int w, int h) const
|
||||
{105, 241}, // US Common
|
||||
{110, 220}, // DLE
|
||||
{210, 330}, // Folio
|
||||
{431.8f, 279.4f}, // Ledger
|
||||
{279.4f, 431.8f} // Tabloid
|
||||
{431.8f, 279.4f}, // Ledger (28) note, two names for same size paper (ANSI B)
|
||||
{279.4f, 431.8f} // Tabloid (29) causes trouble with orientation on PDF export
|
||||
};
|
||||
|
||||
QPrinter::PaperSize ps = QPrinter::Custom;
|
||||
@@ -739,13 +744,19 @@ QPrinter::PaperSize MDIViewPage::getPaperSize(int w, int h) const
|
||||
ps = static_cast<QPrinter::PaperSize>(i);
|
||||
break;
|
||||
}
|
||||
else
|
||||
else //handle landscape & portrait w/h
|
||||
if (std::abs(paperSizes[i][0]-h) <= 1 &&
|
||||
std::abs(paperSizes[i][1]-w) <= 1) {
|
||||
ps = static_cast<QPrinter::PaperSize>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ps == QPrinter::Ledger) { //check if really Tabloid
|
||||
if (w < 431) {
|
||||
ps = QPrinter::Tabloid;
|
||||
}
|
||||
}
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
|
||||
448
src/Mod/TechDraw/Templates/ANSIB_Portrait.svg
Normal file
448
src/Mod/TechDraw/Templates/ANSIB_Portrait.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 25 KiB |
Reference in New Issue
Block a user