You are asking Qt to send the output to a printer. Qt does not care that is is not a physical printer or what that printer does with it. If Adobe's Distller chooses to make a high resolution raster image of a page that has nothing to do with Qt.
If you ask Qt to render directly to a PDF, with QPrinter::setOutputFormat() and QPrinter::setOutputFileName(), then you are likely to get a different result because Qt has some control. Try this experiment:
#include <QApplication>
#include <QPainter>
#include <QPrinter>
#include <QPen>
int main(int argc, char **argv)
{
printer.
setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName("test.pdf");
QRect rect
= printer.
pageRect();
rect.moveTo(0, 0);
p.
setPen(QPen(Qt
::DashLine));
p.drawRect(rect);
for (int i = 0; i < rect.height(); i += rect.height() / 50) {
}
p.end();
return 0;
}
#include <QApplication>
#include <QPainter>
#include <QPrinter>
#include <QPen>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QPrinter printer(QPrinter::HighResolution);
printer.setPaperSize(QPrinter::A4);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName("test.pdf");
QPainter p(&printer);
QRect rect = printer.pageRect();
rect.moveTo(0, 0);
p.setPen(QPen(Qt::DashLine));
p.drawRect(rect);
for (int i = 0; i < rect.height(); i += rect.height() / 50) {
p.drawLine(QPoint(0, i), QPoint(rect.width(), i));
}
p.end();
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks