# wcag-pdf

> Check the Accessibility of a PDF Document

Latest version **5.0.6** (published 2022-06-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install wcag-pdf
pnpm add wcag-pdf
yarn add wcag-pdf
bun add wcag-pdf
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.0.6 |
| Published | 2022-06-19 |
| First published | 2015-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14.19.2 |
| Dependencies | 4 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 (+26 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Geir Gåsodden |
| Maintainers | zrrrzzt |
| Keywords | pdf, wcag, validation, validator |

## Links

- npm: https://www.npmjs.com/package/wcag-pdf
- Repository: https://github.com/zrrrzzt/node-wcag-pdf
- Homepage: https://github.com/zrrrzzt/node-wcag-pdf#readme
- Issues: https://github.com/zrrrzzt/node-wcag-pdf/issues
- npm.io page: https://npm.io/package/wcag-pdf

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) 0.27.2
- [cheerio](https://npm.io/package/cheerio.md) 1.0.0-rc.11
- [form-data](https://npm.io/package/form-data.md) 4.0.0
- [valid-url](https://npm.io/package/valid-url.md) 1.0.9

## 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

- 5.0.6 (latest) — 2022-06-19
- 5.0.5 — 2021-11-28
- 5.0.4 — 2021-05-01
- 5.0.3 — 2021-02-03
- 5.0.2 — 2020-06-09
- 5.0.1 — 2020-04-29
- 5.0.0 — 2020-04-29
- 4.0.0 — 2019-10-07
- 3.0.1 — 2019-02-15
- 3.0.0 — 2018-02-15
- 2.1.0 — 2017-09-21
- 2.0.1 — 2017-09-21
- 2.0.0 — 2016-11-08
- 1.0.1 — 2015-11-06
- 1.0.0 — 2015-11-06

## README

[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

# node-wcag-pdf

Check the Accessibility of a PDF Document using [eiii](http://checkers.eiii.eu/en/pdfcheck/).

You can check a pdf by url or path to file.

## Installation

From npm

```sh
$ npm install wcag-pdf
```
From GiHub

```sh
$ git clone git@github.com:zrrrzzt/node-wcag-pdf.git
```

cd into directory and run the setup script

```sh
$ npm run setup
```

## Usage

Supports promises and callbacks.

### Promises

To check a pdf by url

```JavaScript
'use strict'

const checkPdf = require('wcag-pdf')
const fileUrl = 'http://www.difi.no/sites/difino/files/difi-rapport-2015-7-digitale-barrierar-norske-nettstader.pdf'

checkPdf(fileUrl)
  .then(console.log)
  .catch(console.error)
```

returns

```JavaScript
{ pdfIsValid: true,
  passed: 0,
  failed: 0,
  totalChecked: 0,
  resultUrl: '' }
```

if the pdf is not valid the result might look like this

```JavaScript
{ pdfIsValid: false,
  passed: 4,
  failed: 4,
  totalChecked: 8,
  resultUrl: 'http://checkers.eiii.eu/en/pdfcheck/?url=https%3A//helsedirektoratet.no/Documents/Folkehelsearbeid%2520i%2520kommunen/Nyhetsbrev-folkehelsearbeid-2015-4.pdf' }
```
check a pdf by file

```javascript
'use strict'

const checkPdf = require('node-wcag-pdf')
const filePath = 'test/data/invalid.pdf'

checkPdf(fileUrl)
  .then(console.log)
  .catch(console.error)
```

returns

```JavaScript
{ pdfIsValid: false,
  passed: 4,
  failed: 4,
  totalChecked: 8,
  resultUrl: '' }
```

### Callbacks

To check a pdf by url

```JavaScript
'use strict'

const checkPdf = require('wcag-pdf')
const fileUrl = 'http://www.difi.no/sites/difino/files/difi-rapport-2015-7-digitale-barrierar-norske-nettstader.pdf'

checkPdf(fileUrl, (error, data) => {
  if (error) {
    console.error(error)
  } else {
    console.log(data)
  }
})
```

returns

```JavaScript
{ pdfIsValid: true,
  passed: 0,
  failed: 0,
  totalChecked: 0,
  resultUrl: '' }
```

if the pdf is not valid the result might look like this

```JavaScript
{ pdfIsValid: false,
  passed: 4,
  failed: 4,
  totalChecked: 8,
  resultUrl: 'http://checkers.eiii.eu/en/pdfcheck/?url=https%3A//helsedirektoratet.no/Documents/Folkehelsearbeid%2520i%2520kommunen/Nyhetsbrev-folkehelsearbeid-2015-4.pdf' }
```

check a pdf by file


```javascript
'use strict'

const checkPdf = require('node-wcag-pdf')
const filePath = 'test/data/invalid.pdf'

checkPdf(filePath, function (error, data) {
  if (error) {
    console.error(error)
  } else {
    console.log(data)
  }
})
```

returns

```JavaScript
{ pdfIsValid: false,
  passed: 4,
  failed: 4,
  totalChecked: 8,
  resultUrl: '' }
```

## Related

- [node-wcag-pdf-cli](https://github.com/zrrrzzt/node-wcag-pdf-cli) cli for this module

## License

[MIT](LICENSE)

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