Tools to Capture and Convert the Web

Take Website Screenshots with Node.js

Node.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.

This library is server-side only. If you want to process captures with client-side JavaScript, you should use our client-side JavaScript API instead.

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("Sign in to view your Application Key", "Sign in to view your 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
// Or to take a PDF screenshot
// Or to convert online videos into animated GIF's
// Or to capture table(s)
// 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
// To convert HTML file into a image
// Or convert HTML file into a PDF document
// Or convert HTML file into a CSV, XLSX or JSON document

Next the capture must be saved, to do this you must use either the save or save_to method, both of which pass in a function to handle any errors that have occured. The save method call below includes the URL of the handler that will process the callback from GrabzIt and save the screenshot or capture."", function (error, id){
    if (error != null){
        throw error;
Always use the save_to method on localhost

The other option is to use the synchonous save_to method, which will force your application to wait while the screenshot is created so it should only be used were the save method cannot be used.

Once the screenshot is created it will be automatically saved to the file path provided. Note that the Node.js Library will only work on the server side as it requires server features in order to work properly.

client.save_to("images/result.jpg", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;

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.