Quote Originally Posted by nish View Post
may be i did not got your question, but you stated exactly what is written in docs.
Thanks for your reply. Just let me make the question clearer.
The following pseudo code is a snippet of my code:
Qt Code:
  1. QPrinter printer(printerInfo , QPrinter::HighResolution);
  2. printer.setPageMargins( 10.0 , 10.0 , 10.0 , 10.0 , QPrinter::DevicePixel );
  3. QRect totalRect = printer.pageRect();
  4. QPainter painter( &printer );
  5. //Here, I draw the text from (0,0)
  6. painter.drawText( QRect(0,0,totalRect.width() , totalRect.height() ) ,
  7. Qt::AlignLeft | Qt::TextJustificationForced | Qt::TextIncludeTrailingSpaces
  8. | Qt::TextExpandTabs | Qt::TextWordWrap
  9. | Qt::TextWrapAnywhere ,
  10. 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
because "the origin of the painter's coordinate system will coincide with the top-left corner of the page rectangle".
Therefore, I draw text from the coordinates ( 0 , 0 ). However , when I test this with a printer, I find that the text is printed out of
both left and right edge.
Then I tried to adjust the rect for drawing text, when I shrink the text rect for , say 10 pixels, it will work well.
I think this implies that the origin of painter is not the top-left corner of page rectangle or I make mistakes in the code.