Hi there,
I have trouble printing a rich text document to a printer with HighResolution settings.
So far I use something in the lines of:
context.
palette.
setColor(QPalette::Text, painter
->pen
().
color());
layout->draw(painter, context);
QAbstractTextDocumentLayout* layout = text.documentLayout();
QAbstractTextDocumentLayout::PaintContext context;
context.palette.setColor(QPalette::Text, painter->pen().color());
layout->draw(painter, context);
To copy to clipboard, switch view to plain text mode
whereas text is a QTextDocument, and painter is a QPainter created for a printer object. The printer was initialized with QPrinter::HighResolution.
It seems that printing with high-resolution is somewhat tricky. For example, the font metrics returned have to be scaled manually to obtain a correct line spacing. And maybe that's also the reason why the draw() function of QAbstractTextDocumentLayout doesn't work as expected?
Any suggestions are welcome!
Andreas
Bookmarks