Qt-interest Archive, July 2007
QPainter::setWindow() Problem with QPrinter
Message 1 in thread
Hi!
I have a problem with QPainter::setWindow() on QPrinter.
When I create a PDF-Document the following way, it works perfectly:
QPrinter printer(QPrinter::HighResolution);
printer.setFullPage(true);
printer.setPageSize(QPrinter::A4);
printer.setOrientation(QPrinter::Portrait);
printer.setOutputFileName(pdffilename);
printer.setOutputFormat(QPrinter::PdfFormat);
QPainter painter(&printer);
painter.setWindow(0, 0, 2100, 2970);
// ... some drawing operations ...
I can draw with 0.1 mm units and cover the full page perfectly.
If I want to print directly to a real printing device the following way,
the output is very small placed in the left-top corner of the page.
QPrinter printer(QPrinter::HighResolution);
printer.setFullPage(true);
printer.setPageSize(QPrinter::A4);
printer.setOrientation(QPrinter::Portrait);
QPrintDialog printDialog(&printer);
if(printDialog.exec() != QDialog::Accepted)
return false;
QPainter painter(&printer);
painter.setWindow(0, 0, 2100, 2970);
// ... some drawing operations ...
Is it a QT bug, or is it just me.. :-)?
Does somebody know a solution?
Thank you!! :-)
Greetings
Niklas
--
[ signature omitted ]
Message 2 in thread
The answer:
http://trolltech.com/developer/task-tracker/index_html?id=173213&method=entry
Greetings
Niklas
Niklas Hofmann schrieb:
> Hi!
>
> I have a problem with QPainter::setWindow() on QPrinter.
>
> When I create a PDF-Document the following way, it works perfectly:
>
> QPrinter printer(QPrinter::HighResolution);
> printer.setFullPage(true);
> printer.setPageSize(QPrinter::A4);
> printer.setOrientation(QPrinter::Portrait);
> printer.setOutputFileName(pdffilename);
> printer.setOutputFormat(QPrinter::PdfFormat);
>
> QPainter painter(&printer);
> painter.setWindow(0, 0, 2100, 2970);
>
> // ... some drawing operations ...
>
> I can draw with 0.1 mm units and cover the full page perfectly.
>
> If I want to print directly to a real printing device the following way,
> the output is very small placed in the left-top corner of the page.
>
> QPrinter printer(QPrinter::HighResolution);
> printer.setFullPage(true);
> printer.setPageSize(QPrinter::A4);
> printer.setOrientation(QPrinter::Portrait);
>
> QPrintDialog printDialog(&printer);
> if(printDialog.exec() != QDialog::Accepted)
> return false;
>
> QPainter painter(&printer);
> painter.setWindow(0, 0, 2100, 2970);
>
> // ... some drawing operations ...
>
>
> Is it a QT bug, or is it just me.. :-)?
>
> Does somebody know a solution?
>
> Thank you!! :-)
>
> Greetings
>
> Niklas
--
[ signature omitted ]