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:
printer.
setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName("html.pdf");
m_view->setHtml(html);
m_view->show();
m_view->print(&printer);
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPaperSize(QPrinter::A4);
printer.setOutputFileName("html.pdf");
m_view->setHtml(html);
m_view->show();
m_view->print(&printer);
To copy to clipboard, switch view to plain text mode
But then I try to add, for example, a rectangle:
painter.setBrush(Qt::red);
painter.drawRect(10, 10, 100, 100);
painter.end();
QPainter painter(&printer);
painter.setBrush(Qt::red);
painter.drawRect(10, 10, 100, 100);
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
Bookmarks