npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@okkkde/pdfjs-dist

v0.0.501

Published

Generic build of Mozilla's PDF.js library.

Readme

PDF.js

NOTE

[!NOTE] This is a fork of mozilla/pdfjs, with 3 changes:

  1. Export ES modules in both .js and .mjs formats, since nginx's default MIME types do not serve .mjs files as application/javascript.
  2. Downgrade the target browsers for the legacy build to ES6 (more core-js polyfills).
  3. Added extra handling for web/DOM APIs used in worker scripts that are not polyfilled by core-js, since bundler like Vite do not automatically polyfill these APIs inside worker scripts.
    • Add a typeof check for FinalizationRegistry, as it is not supported in older browsers.

[!TIP] This repository is regularly merged and synchronized with the upstream [[mozilla/pdfjs]]. When a new version is released upstream, a new version with the same version number will be released here.

Quick Start

install

npm install @okkkde/pdfjs-dist

use in vite

const pdfjsLib = await import('@okkkde/pdfjs-dist');
// you can use the legacy worker for improved compatibility
const pdfjsWorker = await import('@okkkde/pdfjs-dist/legacy/build/pdf.worker.js?worker&url');
// or modern worker which works on modern browsers, choose at your own
const pdfjsWorker = await import('@okkkde/pdfjs-dist/build/pdf.worker.js?worker&url');
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsWorker.default;

提示

[!NOTE] 本仓库是 [[mozilla/pdfjs]] 的 fork,有三点改动:

  1. 导出 ES 模块时同时提供 .js.mjs,解决 nginx 默认不按 application/javascript 提供 .mjs 的问题。
  2. legacy 构建的目标浏览器降级到 ES6(更多的 core-js 模块)。
  3. 为 worker 脚本中未被 core-js 覆盖的 web/DOM API 做了额外处理,因为像 Vite 这类打包器不会自动在 worker 里填充这些 API。
    • FinalizationRegistry 增加 typeof 检查,以兼容不支持该特性的旧浏览器。

[!TIP] 本仓库会定期与上游 [[mozilla/pdfjs]] 合并同步,上游有新版本时跟随发布新的版本号一致的版本。

快速开始

安装

npm install @okkkde/pdfjs-dist

在 vite 中使用

const pdfjsLib = await import('@okkkde/pdfjs-dist');
// 为了更好的兼容性,可以使用 legacy worker
const pdfjsWorker = await import('@okkkde/pdfjs-dist/legacy/build/pdf.worker.js?worker&url');
// 或者使用现代 worker,适用于现代浏览器,根据需要选择
const pdfjsWorker = await import('@okkkde/pdfjs-dist/build/pdf.worker.js?worker&url');
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsWorker.default;

PDF.js is a Portable Document Format (PDF) library that is built with HTML5. Our goal is to create a general-purpose, web standards-based platform for parsing and rendering PDFs.

This is a pre-built version of the PDF.js source code. It is automatically generated by the build scripts.

For usage with older browsers/environments, without native support for the latest JavaScript features, please see the legacy/ folder. Please see this wiki page for information about supported browsers/environments.

See https://github.com/mozilla/pdf.js for learning and contributing.