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!
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
scaleto 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:mmdate 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]- 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]
License
This project is licensed under the MIT LICENSE.
Author
Just open an issue to share an idea.
©️ 2024 邱敬幃 Pardn Chiu