Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to save a whole page rendered in a QtWebView as an image?



  • I need to save a page loaded in a QtWebView as an image (preferably jpg or png).
    I am interested in the whole contents of a page, not just the part which is currently visible and has to be scrolled to – from top to bottom (I assume I would have to set a width).
    It would be great if the method would not require to show the QtWebView widget on screen.



  • @hckr You can save a whole page to PDF, but not jpg nor png.

    m_view->page()->printToPdf(filePath);
    


  • Yes, I've seen it before. But the thing is, I'd like to 1) crop a fragment of it later, 2) save it as an image.