# ngx-signaturepad

> Fork of wulfsolter/angular2-signaturepad

Latest version **0.0.10** (published 2021-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngx-signaturepad
pnpm add ngx-signaturepad
yarn add ngx-signaturepad
bun add ngx-signaturepad
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2021-04-15 |
| First published | 2019-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 34.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Wulf Solter |
| Maintainers | fclemonschool |
| Keywords | signature, sign, finger, canvas |

## Links

- npm: https://www.npmjs.com/package/ngx-signaturepad
- Repository: https://github.com/fclemonschool/ngx-signaturepad
- Homepage: https://github.com/fclemonschool/ngx-signaturepad#readme
- Issues: https://github.com/fclemonschool/ngx-signaturepad/issues
- npm.io page: https://npm.io/package/ngx-signaturepad

## Dependencies (1)

- [signature_pad](https://npm.io/package/signature_pad.md) ^2.3.2

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.0.10 (latest) — 2021-04-15
- 0.0.9 — 2019-10-17
- 0.0.8 — 2019-08-26
- 0.0.7 — 2019-06-24
- 0.0.6 — 2019-06-20
- 0.0.5 — 2019-06-04
- 0.0.4 — 2019-06-04
- 0.0.3 — 2019-05-31
- 0.0.2 — 2019-05-31
- 0.0.1 — 2019-05-31

## README

# ngx-signaturepad
![GitHub](https://img.shields.io/github/license/fclemonschool/ngx-signaturepad.svg)
![npm (tag)](https://img.shields.io/npm/v/ngx-signaturepad/latest.svg)

Fork of [wulfsolter/angular2-signaturepad](https://www.npmjs.com/package/angular2-signaturepad).

## Install
`npm install ngx-signaturepad --save`

## Reference Implementation

* [Live Demo](http://lathonez.com/angular2-signaturepad-demo/) - angular2-signaturepad Demo
* [Source](https://github.com/lathonez/angular2-signaturepad-demo) - angular2-signaturepad Demo

## Usage example

API is identical to [szimek/signature_pad](https://www.npmjs.com/package/signature_pad).

Options are as per [szimek/signature_pad](https://www.npmjs.com/package/signature_pad) with the following additions:
* canvasWidth: width of the canvas (px)
* canvasHeight: height of the canvas (px)
The above options are provided to avoid accessing the DOM directly from your component to adjust the canvas size.

```typescript

// import into app module

import { SignaturePadModule } from 'ngx-signaturepad';

...

@NgModule({
  declarations: [ ],
  imports: [ SignaturePadModule ],
  providers: [ ],
  bootstrap: [ AppComponent ]
})

// then import for use in a component

import { Component, ViewChild } from '@angular/core';
import { SignaturePad } from 'ngx-signaturepad/signature-pad';

@Component({
  template: '<signature-pad [options]="signaturePadOptions" (onBeginEvent)="drawStart()" (onEndEvent)="drawComplete()"></signature-pad>'
})

export class SignaturePadPage{

  @ViewChild(SignaturePad) signaturePad: SignaturePad;

  private signaturePadOptions: Object = { // passed through to szimek/signature_pad constructor
    'minWidth': 5,
    'canvasWidth': 500,
    'canvasHeight': 300
  };

  constructor() {
    // no-op
  }

  ngAfterViewInit() {
    // this.signaturePad is now available
    this.signaturePad.set('minWidth', 5); // set szimek/signature_pad options at runtime
    this.signaturePad.clear(); // invoke functions from szimek/signature_pad API
  }

  drawComplete() {
    // will be notified of szimek/signature_pad's onEnd event
    console.log(this.signaturePad.toDataURL());
  }

  drawStart() {
    // will be notified of szimek/signature_pad's onBegin event
    console.log('begin drawing');
  }
}
```

---
_Source: https://npm.io/package/ngx-signaturepad · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
