Giter Club home page Giter Club logo

pdfjs-dist's Introduction

pdfjs-dist

This is a mirror of pdfjs-dist, bundled and exposed as an ES module

Install

npm install @bundled-es-modules/pdfjs-dist

Use

import pdfjs from "@bundled-es-modules/pdfjs-dist/build/pdf";
import viewer from "@bundled-es-modules/pdfjs-dist/web/pdf_viewer";

pdfjs.GlobalWorkerOptions.workerSrc =
  "@bundled-es-modules/pdfjs-dist/pdf.worker.js";

var url = "basicapi.pdf";
var loadingTask = pdfjs.getDocument(url);
//...

Important: Unlike in the original build, the pdfjs.GlobalWorkerOptions.workerSrc is mandatory. We recommend supplying the worker via CDN.

Overview

Structure

├── build/
│   ├── pdf.js                    - display layer
│   └── pdf.worker.js             - core layer
└── web/
    ├── pdf_viewer.js             - top-level viewer import, containing all necessary setup
    ├── module.js                 - pdf-viewer module, transformed from UMD to ESM
    └── util.js                   - utility module for setup

Background

PDFJS is a library by Mozilla, created to facillitate client-side rendering of PDF documents.

Currently, the primary build for this project is provided as UMD-style modules at pdfjs/pdfjs-dist.

Support for es modules in the main project has been requested here (#10317)

Building

# https://github.com/FredKSchott/rollup-plugin-polyfill-node/issues/61
npm i --legacy-peer-deps
npm run build

pdfjs-dist's People

Contributors

dependabot[bot] avatar gpbmike avatar robrez avatar ryan-miller-highspot avatar scmyers11 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.