Thanks a lot for this solution. That's code from my project. It generate 1 bit depth monochrome bitmap from html. Maybe someone will help too.
QWebPage page;
page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
page.setViewportSize(QSize(pageWidth, pageHeight));
auto frame = page.mainFrame();
QEventLoop loop;
QObject::connect(&page, SIGNAL(loadFinished(bool)), &loop, SLOT(quit()));
frame->setHtml(htmlData, QUrl());
loop.exec();
QImage img(QSize(pageWidth, pageHeight),QImage::Format_Mono);
QPainter p(&img);
frame->render(&p);
p.end();
img.save("output.bmp","BMP");