I have some problems to printing a document in different output format. I must save (in pdf) and print with normal printer the same document. This document have a grid that I have painting in svg format, some field and images.

The function that make this document is the same except for the istruction:

Qt Code:
  1. printer->setOutputFormat(QPrinter::NativeFormat);
To copy to clipboard, switch view to plain text mode 
The code is very simple:

Qt Code:
  1. r = new QSvgRenderer(QString("PrintModelWithoutNote.svg"));
  2.  
  3. QPrinter *printer = new QPrinter();
  4. QPainter *paint = new QPainter();
  5.  
  6. if(pdf){
  7. printer->setOutputFormat(QPrinter::PdfFormat);
  8. printer->setOutputFileName("pdf_file.pdf");
  9. }else{
  10. printer->setOutputFormat(QPrinter::NativeFormat);
  11. }
  12.  
  13. paint->begin(printer);
  14. r->render(paint);
  15.  
  16. paint->drawText(QPointF(10, 10), "Test1");
  17. paint->drawText(QPointF(50, 50), "Test2");
  18. paint->end();
To copy to clipboard, switch view to plain text mode 
The problem is that I decided the positions of the text in the pdf format to align themselves with the grid in svg. When I print in native format the text loses alignment with the grid.

I did several tests removing or adding the page margins but without success. The only thing that interests me is to preserve the alignment. Anyone have any suggestions for me?

I hope I have explained my problem well. Thanks in advance.