printer.
setPageMargins( 10.0 ,
10.0 ,
10.0 ,
10.0 ,
QPrinter::DevicePixel );
QRect totalRect
= printer.
pageRect();
//Here, I draw the text from (0,0)
painter.
drawText( QRect(0,
0,totalRect.
width() , totalRect.
height() ) ,
Qt::AlignLeft | Qt::TextJustificationForced | Qt::TextIncludeTrailingSpaces
| Qt::TextExpandTabs | Qt::TextWordWrap
| Qt::TextWrapAnywhere ,
text );
QPrinter printer(printerInfo , QPrinter::HighResolution);
printer.setPageMargins( 10.0 , 10.0 , 10.0 , 10.0 , QPrinter::DevicePixel );
QRect totalRect = printer.pageRect();
QPainter painter( &printer );
//Here, I draw the text from (0,0)
painter.drawText( QRect(0,0,totalRect.width() , totalRect.height() ) ,
Qt::AlignLeft | Qt::TextJustificationForced | Qt::TextIncludeTrailingSpaces
| Qt::TextExpandTabs | Qt::TextWordWrap
| Qt::TextWrapAnywhere ,
text );
To copy to clipboard, switch view to plain text mode
According to the doc , if I want to draw text from the top-left corner of page rectangle, I do not need to consider the paper rectangle
Bookmarks