Programmatically Get a Screenshot of a Page

Programmatically get a screenshot of a page

https://screenshotlayer.com/documentation is the only free service I can find lately...

You'll need to use HttpWebRequest to download the binary of the image. See the provided url above for details.

HttpWebRequest request = HttpWebRequest.Create("https://[url]") as HttpWebRequest;
Bitmap bitmap;
using (Stream stream = request.GetResponse().GetResponseStream())
{
bitmap = new Bitmap(stream);
}
// now that you have a bitmap, you can do what you need to do...

Taking screenshot of a webpage programmatically

I searched and searched and searched and found it Webpage thumbnailer (a The Code Project article).

Capture screenshot of browser content (website)

Do you know about Selenium?
It's a testing tool that actually opens a specific browser and runs scripted tests.
It can be used to take screenshots as well.

This might be a solution to your problem.

How to take screenshot of WHOLE activity page programmatically?

One way is to extract the bitmap of the current screen and save it. Try this:

public void takeScreenshot(){
Bitmap bitmap = getScreenBitmap(); // Get the bitmap
saveTheBitmap(bitmap); // Save it to the external storage device.
}

public Bitmap getScreenBitmap() {
View v= findViewById(android.R.id.content).getRootView();
v.setDrawingCacheEnabled(true);
v.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());

v.buildDrawingCache(true);
Bitmap b = Bitmap.createBitmap(v.getDrawingCache());
v.setDrawingCacheEnabled(false); // clear drawing cache
return b;
}

Android take screen shot programmatically

How can I take a screenshot/image of a website using Python?

On the Mac, there's webkit2png and on Linux+KDE, you can use khtml2png. I've tried the former and it works quite well, and heard of the latter being put to use.

I recently came across QtWebKit which claims to be cross platform (Qt rolled WebKit into their library, I guess). But I've never tried it, so I can't tell you much more.

The QtWebKit links shows how to access from Python. You should be able to at least use subprocess to do the same with the others.

Take a screenshot of a webpage with JavaScript?

I have done this for an HTA by using an ActiveX control. It was pretty easy to build the control in VB6 to take the screenshot. I had to use the keybd_event API call because SendKeys can't do PrintScreen. Here's the code for that:

Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Public Const CaptWindow = 2

Public Sub ScreenGrab()
keybd_event &H12, 0, 0, 0
keybd_event &H2C, CaptWindow, 0, 0
keybd_event &H2C, CaptWindow, &H2, 0
keybd_event &H12, 0, &H2, 0
End Sub

That only gets you as far as getting the window to the clipboard.

Another option, if the window you want a screenshot of is an HTA would be to just use an XMLHTTPRequest to send the DOM nodes to the server, then create the screenshots server-side.

How do you take a full webpage screenshot on a Windows computer?

Use some extensions such as Fireshot. The extension is available for both Firefox and Chrome.

Link: https://chrome.google.com/webstore/detail/capture-webpage-screensho/mcbpblocgmgfnpjjppndjkmgjaogfceg?hl=en



Related Topics



Leave a reply



Submit