PDA

View Full Version : How to use QtWebEngine to take a full web page screenshot?



qtcenter2019
27th March 2019, 16:06
You can render QWebEngineView as follows:

QSize size=page()->contentsSize().toSize();
int w=size.width();
int h=size.height();
image=new QImage(w,h, QImage::Format_ARGB32);
painter = new QPainter(image);
render(painter);
image->save(filename);

But this only renders the widget to the image, not the whole web page. If the size of the widget is smaller than the whole web page, some of the web page is not shown on the widget, thus not rendered to the image. How to render the whole web page to the image?

olzzen
1st September 2023, 09:23
Did you ever find a solution to this?