GrabzIt
Tools to Capture and Convert the Web

Take Website Screenshots with Node.jsNode.js API

The diagnostics panel can help you debug your code!

The best way to put website screenshots and more into your Node.js application is by following these steps:

  1. Get your free Application Key and Secret.
  2. Download the free Node.js Library and try out the Demo Application.
  3. Find out the basics about how GrabzIt's API works by reading the below overview.

Node.js API Overview

To use the API you will first need to create the Client object, passing your application key and application secret from your GrabzIt account to the constructor.

var grabzit = require('grabzit');

var client = new grabzit("APPLICATION KEY", "APPLICATION SECRET");

Then use one of the image, PDF, animation or table methods to capture a URL or convert HTML.

// To take a image screenshot
client.url_to_image("http://www.google.com"); 	
// Or to take a PDF screenshot
client.url_to_pdf("http://www.google.com");
// Or to convert online videos into animated GIF's
client.url_to_animation("http://www.example.com/video.avi");
// Or to capture table(s)
client.url_to_table("http://www.google.com");
// To convert HTML into a image
client.html_to_image("<html><body><h1>Hello World!</h1></body></html>"); 	
// Or convert HTML into a PDF document
client.html_to_pdf("<html><body><h1>Hello World!</h1></body></html>");
// Or convert HTML into a CSV, XLSX or JSON document
client.html_to_table("<html><body><table><tr><th>Name</th><th>Age</th></tr>
    <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr>
    </table></body></html>");
// To convert HTML file into a image
client.file_to_image("example.html"); 	
// Or convert HTML file into a PDF document
client.file_to_pdf("example.html");
// Or convert HTML file into a CSV, XLSX or JSON document
client.file_to_table("tables.html");

Next the capture must be saved, to do this use the save or save_to method. The save method call includes the URL of the handler that will process the callback from GrabzIt and save the screenshot or capture.

client.save("http://www.example.com/handler"); 	

The other option is to use the synchonous save_to method. Once the screenshot is created it will be automatically saved to the file path provided.

client.save_to("images/result.jpg"); 	

More Options

This is only a overview of GrabzIt's Node.js API, there are many more options when creating screenshots, animated GIF's or converting HTML including; configuring the browser height, browser width, screenshot height, screenshot width, the delay before a screenshot is taken and the image format of the screenshot. For all these options and the ability to convert the web into PDF's, CSV's or Animated GIF's please see the Client documentation.

Try all our premium features for free with a 7 day free trial. Then from $5.99 a month, unless cancelled.
  • More Captures
  • More Features
  • More API's
  • Bigger Scrapes
  • Bigger Screenshots
  • Bigger Everything
Start Free Trial