2 Attachment(s)
QPrinter on QGraphicsScene Border Problem
How i can leave QPrinter border / margin ? my QGraphicsScene is exact A4...
the grey part is the paper & white is margin to write...
i wand fill exact the grey part on A4..
Now here .. QPrinter display a default border i suppose...
Code:
/* XSL-FO -editor base widget */
/* http://www.zvon.org/xxl/xslfoReference/Output/index.html
<fo:simple-page-master margin-right="5pt" margin-left="5pt" margin-bottom="22pt" margin-top="22pt" page-width="21cm" page-height="29.7cm" master-name="first">
<fo:region-body/>
</fo:simple-page-master>
*/
void DisplayScene::MakefilePrintPdf()
{
if (fileName.size() > 1) {
QString UserlastDirOpen
= fileName.
left(fileName.
lastIndexOf("/"))+"/";
setter.setValue("LastDir",UserlastDirOpen);
printer.
setOutputFormat(QPrinter::PdfFormat);
if (!fileName.endsWith(".pdf")) {
fileName = fileName+".pdf";
}
printer.setOutputFileName(fileName);
scene->render(&painter); /* scene QGraphicsScene */
if (is_file(fileName)) {
/* disply pdf if exist! */
OpenDesktop
(QUrl(fileName
));
}
}
}
Re: QPrinter on QGraphicsScene Border Problem
Change the viewport of the painter to the size of printable area.