skip to Main Content
Screen Capture Using JAVASCRIPT PhantomJs

Screen capture using JAVASCRIPT PhantomJs

How we can capture the screen of the website to specific position and size using JAVASCRIPT. Let’s see we can capture screen and store it as an Image file using PhantomJs.

First of all, Download PhantomJs form here.

After, download PhantomJs create the new javascript file screencapture.js Then past the below content.

var page = require('webpage').create();
page.viewportSize = { width: 1300, height: 2000 };
page.clipRect = { top: 0, left: 0, width: 1300, height: 2000 };'', function() {

Now, change the page URL as you want for capture screen.

Change the Image height and width as you want Also, you can set the image position as you want.

After past, that code run the js file like below.

phantomjs.exe screencapture.js

After, complete find “thecodingstuff.png” file on your directory.

If you face any issue after using above command write the comment below.


I am a web designer and developer part-time blogger. Write something on some free time. Find my every day thought here :)

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top