QWebSettings::clearMemoryCaches();
C++ (Qt)...QPrinter *printer = new QPrinter;printer->setColorMode(QPrinter::GrayScale);printer->setOutputFormat(QPrinter::PdfFormat);printer->setOutputFileName(this->_invoiceFilepath());QWebPage *page = new QWebPage(this);connect(page, &QWebPage::loadFinished, this, [&] (){ page-> mainFrame()-> print( printer); // СИГа});page->mainFrame()->setHtml(html);
C++ (Qt)QWebPage *page = new QWebPage(this);connect(page, &QWebPage::loadFinished, this, [this] (){ QPrinter printer; printer.setColorMode(QPrinter::GrayScale); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(this->_invoiceFilepath()); qobject_cast<QWebPage*>(this->sender())->mainFrame()->print(&printer); this->sender()->deleteLater();});page->mainFrame()->setHtml(html);