Skip to content

uthanhercules/draw-html-to-canvas

Repository files navigation

Render HTML to Canvas

Render a HTML text template into a canvas context.

// To import
const drawHTML = require('render-html-into-canvas');

// To use
const canvas = yourCanvas;
const context = canvas.getContext('2d');

const input = "<b>Follow</b> the <i>train,</i> <b><i>CJ!</i></b><br><b>MOVE!</b>;

drawHTML(input, context, { fontFamily: 'Arial', fontSize: 16 });

// Available options
options: {
  fontFamily: 'string',
  fontSize: number,
  padding: number,
  posX: number,
  posY: number,
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published