CefView / QCefView

A Qt Widget encapsulated CEF view based on QWidget
https://cefview.github.io/QCefView/
GNU Lesser General Public License v2.1
529 stars 137 forks source link

Grab the content of a QCefView (web page) and store it to a QImage #7

Closed ShelleyLake closed 3 years ago

ShelleyLake commented 3 years ago

Dear developer, I am trying to find a solution to how I can capture the QWidget (QCefView) content and save it in a QImage. I tried with the typical "myWidget->grab()" function or the equivalent using a QPainter, but the result doesn't change: I only get the background content of the QWidgetbut not the real content (web page). Do you have any idea how to do this?

Thanks in advance. J.

tishion commented 3 years ago

hi @ShelleyLake , I do think it is not possible to grab the snapshot of the webpage by QWidget::grab() method. Actually, the real widow containing the webpage is a native window floating on the top of the QCefView widget. please refer to this comment:https://github.com/CefView/QCefView/blob/72603bf3bca8fe812d5efaca1cab2912c837b1b3/include/QCefView.h#L18-L40

you need to capture the webpage content by GDI or some other approaches. Thanks and good luck.

ShelleyLake commented 3 years ago

Thanks for the explanation

J.