Features

November 22, 2022

Post HTML, CSS and JavaScript

Generate images from HTML on the fly without having to host it at a URL

Jonathan Markwell
Jonathan Markwell
1 min read
Share this article:

If you're generating images from HTML on the fly, you might not want to save the HTML anywhere. Hosting generated pages in a place that Urlbox can reach can also be challenging.

What if you didn't need a URL for the things you want to turn into images?

You can post HTML, CSS and even JavaScript to Urlbox. URLs not required!

Here's an example:

curl -X POST https://api.urlbox.io/v1/render/sync \
  -H 'Authorization: Bearer YOUR_URLBOX_API_SECRET' \
  -H 'Content-Type: application/json' \
  -d '{
    "html": "<div><h1 id=\"title\"></h1><p>Testing</p></div>",
    "js": "document.getElementById(\"title\").innerText=\"Hello World\"",
    "css": "div { padding: 10px; background-color: red } h1 { text-align: center; color: white } p {text-align: center; color: white}",
    "selector": "div",
    "width": "400",
    "height": "300"
  }'

It results in the following image:

Image with white text centred on red back ground saying hello world testing

You still have the full power of Urlbox's rendering engine so you and your designers can make far more beautiful images this way complete with fonts, emoji and anything else you'd expect to render nicely in a browser.

Index

All Features

Free Trial

Designers, law firms and infrastructure engineers trust Urlbox to accurately and securely convert HTML to images at scale. Experience it for yourself.