Hello,

I am currently doing a summer job and I have to make some sort of WYSIWYG editor.

I managed to make the editor. I want to export the content (in HTML format) to PDF and put a background image on the first page. Exporting to PDF works like a charm but I don't know how to put a background image on the first page...

This is what I got so far:
Qt Code:
  1. QPrinter printer(QPrinter::HighResolution);
  2. printer.setOutputFormat(QPrinter::PdfFormat);
  3. printer.setPaperSize(QPrinter::A4);
  4. printer.setOutputFileName("html.pdf");
  5.  
  6. m_view->setHtml(html);
  7. m_view->show();
  8. m_view->print(&printer);
To copy to clipboard, switch view to plain text mode 

But then I try to add, for example, a rectangle:
Qt Code:
  1. QPainter painter(&printer);
  2. painter.setBrush(Qt::red);
  3. painter.drawRect(10, 10, 100, 100);
  4. painter.end();
To copy to clipboard, switch view to plain text mode 
This overwrites the previous painter...

Should I make a new QPaintEngine? Or what should I do?

Thanks in advance!
Gillis