Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.25 KB

File metadata and controls

37 lines (27 loc) · 1.25 KB
id title description
example-code
Example Code
Quickly learn how to use urlbox's URL to PNG rendering API

Sample code is available in the following languages: Node.js, Ruby, PHP, Python, Java and C#.
If you would like help integrating our API with your language please [get in touch](mailto: support@urlbox.io)

Node.js

Sample code to take website screenshots in Node.js

Check out our npm package here here, and on github

// npm install urlbox --save

import Urlbox from "urlbox";

// Plugin your API key and secret
const urlbox = Urlbox(YOUR_API_KEY, YOUR_API_SECRET);

// Set your options
const options = {
  url: "github.com",
  thumb_width: 600,
  format: "jpg",
  quality: 80,
};

const imgUrl = urlbox.buildUrl(options);
// https://api.urlbox.io/v1/YOUR_API_KEY/TOKEN/jpg?url=github.com&thumb_width=600&quality=80

// Now set it as the src in an img tag to render the screenshot
<img src={imgUrl} />;