# pdfjs-ts

> simple pdfjs in typescript

Latest version **0.0.5** (published 2019-06-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install pdfjs-ts
pnpm add pdfjs-ts
yarn add pdfjs-ts
bun add pdfjs-ts
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2019-06-19 |
| First published | 2019-06-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 834 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | bighuangjin |

## Links

- npm: https://www.npmjs.com/package/pdfjs-ts
- Repository: https://github.com/coderjinhui/pdfjs-ts
- Homepage: https://github.com/coderjinhui/pdfjs-ts#readme
- Issues: https://github.com/coderjinhui/pdfjs-ts/issues
- npm.io page: https://npm.io/package/pdfjs-ts

## Dependencies (2)

- [fastscan](https://npm.io/package/fastscan.md) ^1.0.6
- [pdfjs-dist](https://npm.io/package/pdfjs-dist.md) 2.1.266

## Recent versions

- 0.0.5 (latest) — 2019-06-19
- 0.0.4 — 2019-06-19
- 0.0.3 — 2019-06-13
- 0.0.2 — 2019-06-13
- 0.0.1 — 2019-06-13
- 1.0.0 — 2019-06-13

## README

# pdfjs-ts
simple pdfjs in typescript

## Usage
1. copy the static file, you can download in [mozilla pdf.js](https://github.com/mozilla/pdf.js)  or just find in src/pdfjs folder
  - [**must**] copy pdf.worker.min.js in to yout project
  - copy the text_layer_builder.css to your project if you want render text in pdf

2. write code in ts file

```html
<!-- in html file -->
<div id="container"></div>
```

```typescript
// this example is in Angular
// simple single page render
import { PDFTS } from 'pdfjs-ts/dist';
....
this.pdf = new PDFTS({
  url: this.url,
  container: document.querySelector('#container'),
  workerURL: '/assets/pdfjs/pdf.worker.min.js',
});
this.pdf.initial().then(_ => {
  this.pdf.renderer.render();
});

// multiple page
this.pdf = new PDFTS({
  url: this.url,
  container: document.querySelector('#container'),
  workerURL: '/assets/pdfjs/pdf.worker.min.js',
  multiple: true
});
this.pdf.initial().then(_ => {
  this.pdf.renderer.render();
});

// enable webGL
this.pdf = new PDFTS({
  url: this.url,
  container: document.querySelector('#container'),
  workerURL: '/assets/pdfjs/pdf.worker.min.js',
  multiple: true,
  enableWebGL: true
});
this.pdf.initial().then(_ => {
  this.pdf.renderer.render();
});

// render text
this.pdf = new PDFTS({
  url: this.url,
  container: document.querySelector('#container'),
  workerURL: '/assets/pdfjs/pdf.worker.min.js',
  multiple: true,
  renderText: true,
});
this.pdf.initial().then(_ => {
  this.pdf.renderer.render();
});
```

## Feature

- search: almost done
- progress: indevelopment
- other new feture if i want to...

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