Trying to write a function that you pass a QStringList to, and a file name - creates a multiple page PDF - each string list holding HTML for that page.

Here is my code always creates the last page as the only page with page 1 in the corner , new page returns false every time

Qt Code:
  1. void pmdUtility::pmdMakePdf(QStringList oPages,QString qsFileName)
  2. {
  3. QPrinter printer;
  4. printer.setOrientation(QPrinter::Portrait);
  5. printer.setPaperSize(QPrinter::A4);
  6. printer.setResolution(300);
  7. printer.setFullPage(false);
  8. printer.setCopyCount(1);
  9. printer.setColorMode(QPrinter::Color);
  10.  
  11. printer.setOutputFormat(QPrinter::PdfFormat);
  12. printer.setOutputFileName(qsFileName);
  13. QRect Rect1(0.0,0.0,printer.width(),printer.height());
  14. foreach (QString qsPage, oPages)
  15. {
  16. printer.newPage();
  17.  
  18. QTextDocument document;
  19. document.setHtml(qsPage);
  20. document.print(&printer);
  21. }
  22. }
To copy to clipboard, switch view to plain text mode