I’m facing an issue while displaying an HTML page (that I dynamically built) within QWebEngine
because, as indicated in the doc here (https://doc.qt.io/qt-6/qwebengineview.html#setHtml), content larger than 2 MB cannot be displayed directly using setHtml()
.
As suggested in some SO posts, dumping my HTML code to a local file and then displaying it via QWebEngineView::load(QUrl::fromLocalFile())
allowed me to workaround this limitation.
However, I would also like to be able to export this page in PDF format, I tried via QWebEngineView::printToPdf()
but it fails for such “big” pages (and works for normal pages).
Do you know how I could workaround this HTML to PDF export issue in Qt? I guess that I could try to use some 3rd party library/tool but, if possible, I’d like to avoid complicating too much the code.
Thanks in advance for your help!