在Qt GUI应用程序中使用QtWebkit无头

时间:2012-12-17 14:47:08

标签: pdf qtwebkit

我需要在GUI应用程序中使用Qtwebkit函数,但我不想在我的GUI应用程序中查看webkit。 主要功能是将HTML呈现为pdf。 我知道我可以用QtWebkit无头做到这一点。

1 个答案:

答案 0 :(得分:1)

使用QWebPage,因为它可以在屏幕上不显示任何内容的情况下工作。类似的东西:

QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);

page->mainFrame->print(&printer);
相关问题