0.0.5 • Published 5 years ago

pdfjs-ts v0.0.5

Weekly downloads
6
License
ISC
Repository
github
Last release
5 years ago

pdfjs-ts

simple pdfjs in typescript

Usage

  1. copy the static file, you can download in 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
  1. write code in ts file
<!-- in html file -->
<div id="container"></div>
// 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...
0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

1.0.0

5 years ago