# ngager-pdfwriter

> ReactJS PDF Writer component

Latest version **1.0.13** (published 2020-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngager-pdfwriter
pnpm add ngager-pdfwriter
yarn add ngager-pdfwriter
bun add ngager-pdfwriter
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.13 |
| Published | 2020-03-18 |
| First published | 2020-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 56.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ngager-group |
| Maintainers | nclong87 |

## Links

- npm: https://www.npmjs.com/package/ngager-pdfwriter
- Repository: https://github.com/ngager-group/ngager-pdfwriter
- Homepage: https://github.com/ngager-group/ngager-pdfwriter#readme
- Issues: https://github.com/ngager-group/ngager-pdfwriter/issues
- npm.io page: https://npm.io/package/ngager-pdfwriter

## Recent versions

- 1.0.13 (latest) — 2020-03-18
- 1.0.12 — 2020-03-06
- 1.0.11 — 2020-03-05
- 1.0.10 — 2020-03-05
- 1.0.9 — 2020-03-03
- 1.0.8 — 2020-03-03
- 1.0.7 — 2020-03-03
- 1.0.6 — 2020-03-03
- 1.0.5 — 2020-03-02
- 1.0.4 — 2020-03-02
- 1.0.3 — 2020-02-26
- 1.0.2 — 2020-02-26
- 1.0.1 — 2020-02-26
- 1.0.0 — 2020-02-26

## README

# ngager-pdfwriter

> Very simple ReactJS PDF Writer library using PDFKit

[![NPM](https://img.shields.io/npm/v/ngager-pdfwriter.svg)](https://www.npmjs.com/package/ngager-pdfwriter) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save ngager-pdfwriter
```

## Usage

```jsx
import React, { Component } from 'react'

import Pdf from 'ngager-pdfwriter'

const html2canvas = require('html2canvas');

const text = '3. <b>Consultation Services</b>: The Recruitment team provides <b>consultation on </b>new and replacement positions - hiring  –  process, salary<b> range, </b> hehehe<br><br>   <b>availability, possible</b> challenges/risks and strategies <br>to close the roles.';

const text2 = 'The man who knows his worth respects his fellow man because he respects himself first. He does not boast; is not self-seeking; nor does he force his personal opinion on others.';

const text3 = '<span style="color: #FF6347;font-weight: bold;">#</span> What website or app has completely changed your life for better or for worse?'


class Example extends Component {
  async onClick() {
    const pdf = new Pdf({ defaultFontSize: 11, defaultColor: '#222222' });
    try {
      pdf.addText(text, { fontSize: 12, color: '#BBBBBB' });
      pdf.addText(' ');
      pdf.addIcon('', { color: '#BBBBBB' });
      pdf.moveUp();
      pdf.addText(text2, null, { indent: 16 });
      pdf.addText(' ');
      pdf.addText(text3);
      pdf.addText(' ');
      const canvas = await html2canvas(this.chart);
      const dataUrl = canvas.toDataURL();
      pdf.addImage(dataUrl);

      // add Page
      pdf.addPage();
    } catch (e) {
      console.log('ERROR', e);
    }
    // const blob = await pdf.output();
    // console.log('blob', blob);
    await pdf.save('test.pdf');
  }
  render () {
    return (
      <div>
        <div ref={el => {this.chart = el || this.chart; }} >
          {...chart}
        </div>
        <button onClick={() => this.onClick()}>Download PDF</button>
      </div>
    )
  }
}
```
## Example
https://ngager-group.github.io/ngager-pdfwriter/

## License

MIT © [ngager-group](https://github.com/ngager-group)

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