# @openhealthnz-credentials/pdf-image-qr-scanner

> Library to scan user-uploaded PDF's or images locally and reliably for QR codes using jsQR.

Latest version **1.0.2** (published 2022-01-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @openhealthnz-credentials/pdf-image-qr-scanner
pnpm add @openhealthnz-credentials/pdf-image-qr-scanner
yarn add @openhealthnz-credentials/pdf-image-qr-scanner
bun add @openhealthnz-credentials/pdf-image-qr-scanner
```

## 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.2 |
| Published | 2022-01-17 |
| First published | 2022-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 48.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Jasper Miller-Waugh |
| Maintainers | squareshaped, fallstop, sean-stanley, saille2 |
| Keywords | typescript, nz, apc, qr, pdf, image |

## Links

- npm: https://www.npmjs.com/package/@openhealthnz-credentials/pdf-image-qr-scanner
- Repository: https://github.com/openhealthnz-credentials/pdf-image-qr-scanner
- Issues: https://github.com/openhealthnz-credentials/pdf-image-qr-scanner/issues
- npm.io page: https://npm.io/package/@openhealthnz-credentials/pdf-image-qr-scanner

## Dependencies (2)

- [jsqr](https://npm.io/package/jsqr.md) ^1.4.0
- [pdfjs-dist](https://npm.io/package/pdfjs-dist.md) ^2.12.313

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-01-17
- 1.0.1 — 2022-01-17
- 1.0.0 — 2022-01-17

## README

# pdf-image-qr-scanner

[![License][]](LICENSE)
[![Build Status]](https://github.com/openhealthnz-credentials/pdf-image-qr-scanner/actions/workflows/ci.yml)
[![NPM Package]](https://npmjs.org/package/@openhealthnz-credentials/pdf-image-qr-scanner)
[![semantic-release]](https://github.com/semantic-release/semantic-release)

[license]: https://img.shields.io/badge/MIT-blue.svg
[build status]: https://github.com/openhealthnz-credentials/pdf-image-qr-scanner/actions/workflows/ci.yml/badge.svg
[npm package]: https://img.shields.io/npm/v/@openhealthnz-credentials/pdf-image-qr-scanner.svg
[code coverage]: https://codecov.io/gh/openhealthnz-credentials/pdf-image-qr-scanner/branch/master/graph/badge.svg
[semantic-release]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg

> Library to scan user-uploaded PDF's or images locally and reliably for QR codes using jsQR.

## Install

```bash
npm install @openhealthnz-credentials/pdf-image-qr-scanner # or
yarn add @openhealthnz-credentials/pdf-image-qr-scanner
```

## Use

```typescript
import { scanFile } from "@openhealthnz-credentials/pdf-image-qr-scanner";
...
try {
    // selectedFile: File (https://developer.mozilla.org/en-US/docs/Web/API/File)
    const qrCode = await scanFile(selectedFile);
    // It returns null if no QR code is found
    console.log(qrCode || "No QR code found");
} catch (e) {
    // Example Error Handling
    if (e?.name === "InvalidPDFException") {
        console.log("Invalid PDF");
    } else if (e instanceof Event) {
        console.log("Invalid Image");
    } else {
        console.log("Unknown error:", e);
    }
}

```

Additional examples available in the the [examples](./examples/) folder.
 - [Svelte Web Demo](https://svelte-pdf-image-scanner.fallstop.workers.dev/): [source code](./examples/svelte)
 - [React Web Demo](https://react-pdf-image-qr-scanner.pages.dev/): [source code](./examples/react)

## TODO:
 - Implement AVA tests with browser polyfills.

---
_Source: https://npm.io/package/@openhealthnz-credentials/pdf-image-qr-scanner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
