@compai/html-to-png

Turn an HTML string into a png image.

Usage no npm install needed!

<script type="module">
  import compaiHtmlToPng from 'https://cdn.skypack.dev/@compai/html-to-png';
</script>

README

@compai/html-to-png

Turn an HTML string into a png image.

Installation

yarn add @compai/html-to-png

Usage

import fs from 'fs'
import { render } from '@compai/html-to-png'

const HTML = `
<h1>Hello, world!</h1>
`

(async () => {
  const png = await render(HTML)
  fs.writeFileSync('test.png', png)
})()

Related


OSS by Components AI.