talira

PDF Reader in JavaScript

open sourceApache-2.0self-hostablefree

PDF.js is Mozilla's PDF viewer built with HTML5: a library that parses and renders PDFs in the browser, plus a complete viewer application. It's the PDF viewer built into Firefox, and Mozilla describes it as a general-purpose, web standards-based platform for parsing and rendering PDFs. Apps embed it through the pdfjs-dist package to draw pages on a canvas, extract text, or show the full viewer. An online debugger shows a PDF's internal structure.

Ways to install

Package managers

Problems it solves

  • show a PDF inside my web app without relying on the browser's built-in viewer
  • render each page of a PDF to a canvas so I can draw boxes on top
  • extract the text and its positions from a PDF in JavaScript
  • an open source PDF viewer I can embed and style
  • take screenshots of PDF pages in a headless browser for visual tests
  • render PDF thumbnails in the browser
  • inspect the internal structure of a broken PDF

Features

  • PDF parsing and rendering
  • full viewer application
  • built into Firefox
  • official Chrome extension
  • PDF debugger for a file's internal structure
  • a legacy build for older browsers

Alternatives

The same job

These do what PDF.js does.

  1. Apryse SDK (WebViewer) Document SDKs for viewing, editing and extracting data across 100+ formats
  2. Nutrient (formerly PSPDFKit) The document layer for agents
  3. pypdfium2 Python bindings to PDFium, reasonably cross-platform
  4. hayro A set of Rust crates for parsing, interpreting and rendering PDF files.
  5. pdfium-render A high-level idiomatic Rust wrapper around Pdfium, the C++ PDF library used by the Google Chromium project.
  6. MuPDF The ultimate library for managing PDF documents

Compare PDF.js with the top 3