March 16, 2012

tsai146 tsai146
Lab Rat
1 posts

how to take screenshot of particular element in a web site

 

Is it possible to take screenshot of particular element in a web page.

by using “mainFrame->render” function, I can get screenshot of the entire web page; however, I am only interested in particular element. for example: id=“test”

QWebElement document = mainFrame->documentElement();
QWebElement test= document.findFirst(”#test”);
test.geometry();

I was plan to use geometry to capture the coordination, and hopefully to use it to crop the image.
Anyway, it always returns QRect(0,0 0×0) when I tried to get geometry of my element.

What could be the issue or is there any alternative to achieve the same goal?

Thanks, in advance.

0 replies

 
  ‹‹ Accessing Webkit classes from Qt project 4.8.0, starting with MSVC 2010.      how to get a case insesitive attribute of a element in qt webkit ››

You must log in to post a reply. Not a member yet? Register here!