1.1.0

pardnio/pdf2image

Last updated

NoteThis README was generated by SKILL, get the ZH version from here.



TURN ANY PDF INTO IMAGES RIGHT IN THE BROWSER!


npmDownloadsLicense




A JavaScript browser library with PDF-to-image conversion, live progress overlay, and one-click ZIP download

Table of Contents



Features


npm i @pardnchiu/pdf2image · Documentation

  • Client-Side Conversion — pdf.js renders each PDF page to PNG, JPG, or WebP inside the browser, so files never leave the user's machine.
  • Zero-Config Dependencies — A single script tag preconnects to the CDN and loads pdf.js, JSZip, and the stylesheet automatically.
  • Concurrent Page Rendering — All pages render to canvas in parallel, with an adjustable scale to trade quality for speed.
  • Built-in Progress Overlay — Conversion and compression show a percentage overlay that switches between Chinese and English based on browser locale.
  • One-Click ZIP Download — JSZip bundles the output images, and filenames accept a yyyy-MM-DD hh:mm date template.

Architecture


Full Architecture

graph TB
    Script[pdf2image.js loaded] --> CDN[CDN dependency injection<br/>pdf.js / JSZip / CSS]
    App[Caller] --> Converter[pdf2image class]
    Converter -->|convert| PDFJS[pdf.js render<br/>canvas → Data URL]
    Converter -->|download| ZIP[JSZip bundle<br/>Blob download]
    PDFJS --> Loading[Progress overlay]
    ZIP --> Loading
    PDFJS --> Images[images array]
  1. graph TB
  2. Script[pdf2image.js loaded] --> CDN[CDN dependency injection<br/>pdf.js / JSZip / CSS]
  3. App[Caller] --> Converter[pdf2image class]
  4. Converter -->|convert| PDFJS[pdf.js render<br/>canvas → Data URL]
  5. Converter -->|download| ZIP[JSZip bundle<br/>Blob download]
  6. PDFJS --> Loading[Progress overlay]
  7. ZIP --> Loading
  8. PDFJS --> Images[images array]

License


This project is licensed under the MIT LICENSE.

Author


Just open an issue to share an idea.
pdf2image contributors


©️ 2024 邱敬幃 Pardn Chiu
中文