Skip to main content

Introduction

@hyzyla/pdfium is a TypeScript/JavaScript wrapper for the PDFium library:

  • ⬇️ pdfium - an open-source library for PDF manipulation and rendering, developed by Google and used in Google Chrome browser.
  • ⬇️ pdfium-lib - project by Paulo Coutinho to compile PDFium library to multiple platforms, including WebAssembly.
  • 📍 @hyzyla/pdfium - (you are here) TypeScript/JavaScript wrapper for the WebAssembly build of PDFium library.

Features

  • 📦 Zero dependencies - PDFium library is compiled to WebAssembly and bundled with the package.
  • 🔒 Type-safe - TypeScript definitions are included.
  • 🗼 Works in browser and Node.js

Supported environments

  • Node.js 22 or newer, tested on 22, 24 and 26.
  • Chrome and Edge 85+, Firefox 79+ and Safari 15+. The tests run in Chrome, Firefox and WebKit, with the package bundled by Vite, bundled by webpack, and loaded without a bundler.
  • @hyzyla/pdfium/worker starts a module worker, which Firefox supports from version 114.

In older browsers the library throws an error when it loads, because PDFium's WebAssembly build checks the browser version. On older Node.js versions, npm warns when you install the package.

Use cases

Main use case for this library is to render PDF files to images, but if you need to do something else with PDF files that is supported by PDFium, but not included in this library, feel free to open an issue or a pull request on GitHub.

Examples how to render PDF files to images can be found on 👉 "Render PDF to image" page.

Installation

# yarn add @hyzyla/pdfium
# pnpm install @hyzyla/pdfium
npm install @hyzyla/pdfium