[PySide] QWebEngineView resize error

Dennis Pielken dennis at batland.de
Tue Sep 8 19:24:42 CEST 2020


    Hi

Am 08/09/2020 um 18:44 schrieb Tim Roberts:
> Dennis Pielken wrote:
>> ...
>> I want to use QWebEngineView to create a screenshot of a complete web 
>> page. This is mostly working for “shorter pages”, but it is not 
>> working for longer pages.
>>
>> The only solution to take a screenshot of a complete webpage is to 
>> resize the QWebEngineView to the contentSize of QWebEnginePage. The 
>> following code is working for shorter pages (self inherits 
>> QWebEngineView):
>> ...
>> generates the following errors:
>>    QOpenGLFramebufferObject: Framebuffer incomplete attachment.
>> ...
>>    QOpenGLFramebufferObject: Framebuffer incomplete attachment.
>>    QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.
>>    [13092:9676:0908/151509.277:ERROR:gles2_cmd_decoder.cc(5678)]
>>    GLES2DecoderImpl::ResizeOffscreenFramebuffer failed to allocate
>>    storage due to excessive dimensions.
>> ...
>> This error can be reproduced with longer Facebook timelines as well.
>>
>> The gles2 errors (the last three lines) are repeated indefinitely. I 
>> have not found a way to fix this. I have checked that the page is not 
>> bigger than the maximum size of the widget.
>
> What do you mean by that?  Facebook pages can be infinitely long; they 
> generate new data as you scroll toward the bottom of what was already 
> sent.  There are limits to the size of bitmaps, and of course there 
> are limits to your memory.  Even the browsers don't store the whole 
> page in memory as a bitmap. 

I may have described the problem not detailed enough. I want to create a 
screenshot of the webpage in the state that has been loaded by the 
user.  Therefore, the page will always have a finite height / width.

An example page, where the problem occurs, is www.heise.de - just scroll 
down until you reach the end and screenshot code will fail.

Before I resize QWebEngineView, I check that contentSize is not bigger 
than qwidget.maximumHeight. Therefore, the resize should be possible (?) 
But it fails.

I know about possible work-around (just don't resize, grab the current 
widget, set all elements withposition:fixed to non-fixed and scroll 
down, but then you have do deactivate any kind of dynamic reload so that 
no additional data is being loaded by scrolling). Therefore, I would 
like to achieve this without scrolling in the page.

I do understand that QImage and QPixmap have a maximum size and 
therefore (in case the resize work), I have to grab() the widget in 
chunks. But I don't even reach this ;)

Am I missing anything or is it just not possible?



More information about the PySide mailing list