Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

canvas-autograph

DamonZhang67MIT2.0.2TypeScript support: included

Handwritten signature based on canvas

canvas, autograph

readme

canvas-autograph

NPM version

Install

npm install canvas-autograph
yarn add canvas-autograph

Usage

import Autograph from 'canvas-autograph';

new Autograph(options);

API

options configuration

Params Desc Types Required Default
el specify the rendered dom element selector string yes -
font set the font of the canvas text string no '14px Arial'
alpha set the transparency of the canvas number no 1
imgType set the type of generated image string no 'png'
offsetX set the x axis offset of the path number no 0
offsetY set the y axis offset of the path number no 0
fillColor set the fill color string no '#fff'
lineWidth set line width number no 3
strokeColor set path color string no '#000'

instance method

Function Desc Callback Parameter
onSaveUrl save picture (color) => Promise
onClear clear canvas () => void
destroy destroy the instance () => void