https://github.com/pardnio/pdf2image
PDF-to-image converter
https://github.com/pardnio/pdf2image
frontend javascript pardnchiu pdf-to-image pdf-to-jpg pdf-to-png pdf-to-webp vanilla-javascript
Last synced: about 1 month ago
JSON representation
PDF-to-image converter
- Host: GitHub
- URL: https://github.com/pardnio/pdf2image
- Owner: pardnio
- License: mit
- Created: 2024-05-29T17:05:05.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-26T16:35:47.000Z (over 1 year ago)
- Last Synced: 2026-04-24T17:35:29.182Z (about 2 months ago)
- Topics: frontend, javascript, pardnchiu, pdf-to-image, pdf-to-jpg, pdf-to-png, pdf-to-webp, vanilla-javascript
- Language: JavaScript
- Homepage: https://pdf2image.pardn.io
- Size: 54.7 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pdf2image


[](https://www.npmjs.com/package/@pardnchiu/pdf2image)
[](https://www.npmjs.com/package/@pardnchiu/pdf2image)
[](https://www.jsdelivr.com/package/npm/@pardnchiu/pdf2image)
[](https://github.com/pardnchiu/pdf2image/blob/main/README.zh.md)
## Features
### PDF to Images
- Seamlessly integrates with [pdf.js](https://github.com/mozilla/pdf.js) to efficiently parse PDFs and convert them into images.
- Supports multiple image formats: `jpg`, `png`, `webp` for versatile usage.
### Compressed Downloads
- Leverages [jszip.js](https://github.com/Stuk/jszip) to bundle generated images into a ZIP file for one-click download.
- Automatically names files and ZIP archives for better organization of multipage content.
### High Efficiency and Stability
- Designed with asynchronous processing to ensure a smooth user experience.
- Comprehensive error handling with detailed error messages for easier debugging.
## Installation
### Install via npm
```bash
npm i @pardnchiu/pdf2image
```
### Include via CDN
#### UMD Version
```html
```
#### ES Module Version
```javascript
import { pdf2image } from "https://cdn.jsdelivr.net/npm/@pardnchiu/pdf2image@[VERSION]/dist/pdf2image.esm.js";
```
## How to use
### Initialize `pdf2image`
```Javascript
const converter = new pdf2image({
filename: "image-yyyy-MM-DD_hh:mm", // Specify output filename, supports date format templates [yyyy|MM|DD|hh|mm]
file: [file], // Input PDF file from file input or other sources
scale: 1.5, // Scale factor, default is 1.5
type: "png" // Output image format [jpg|png|webp]
});
// Convert PDF to images
converter.convert().then(images => {
console.log("Successfully converted images:", images);
});
// Download compressed ZIP file
converter.download().then(() => {
console.log("Images have been packed and downloaded!");
});
```
## License
This source code project is licensed under the [MIT](https://github.com/pardnchiu/pdf2image/blob/main/LICENSE) License.
## Creator

邱敬幃 Pardn Chiu
***
©️ 2024 [邱敬幃 Pardn Chiu](https://pardn.io)