1.0.1 • Published 2 years ago

@besties/html2png v1.0.1

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 years ago

@besties/html2png

A wrapper for satori and @resvg/resvg-wasm, adding support for using HTML strings rather than VDOM along with specifying classes for elements by inlining all CSS.

Usage

import html2png from '@besties/html2png'
import fs from 'node:fs'

const someFont = fs.readFileSync('./example.ttf')

fs.promises.writeFile(
	'test.png',
	await html2png(
		'<div class="main"><p>Hello world!</p></div>
		<style>
			.main {
				display: flex;
				justify-content: center;
				align-items: center;
				background-color: #1b171f;
				color: #ffffff;
				width: 100%;
				height: 100%;
				font-size: 4rem;
			}
		</style>',
		{
			width: 400,
			height: 200,
			fonts: [
				{
					name: 'Example',
					data: someFont,
					weight: 400,
					style: 'normal'
				}
			]
		}
	)
)
1.0.1

2 years ago

1.0.0

2 years ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago