@lucas8x/pdfy
v0.5.0
Published
cli tool for converting and compressing a image folder into a single PDF file.
Maintainers
Readme
Pdfy
Pdfy is a CLI tool for converting and compressing a image folder into a single PDF file.
Features
- Converts images from a selected folder into one PDF.
- Supports JPG, PNG, WebP, JFIF, TIFF, SVG, AVIF, BMP formats.
- Resizes images larger than 1920×1080.
- Reports original size vs final PDF size.
- Reduce image size using progressive encoding.
- Reduces the image size by decreasing a bit of the quality.
Requirements
- Node.js 22+ or Bun 1.3+
Install
Using npm:
npm install -g @lucas8x/pdfyAfter install, you can run this command on parent or inside your image directory...
pdfyNOTE: On windows you can press shift + right click to open terminal in selected folder.
Options
pdfy [OPTIONS]
-o, --output <path> Output directory of pdf (default: current working directory)
-c, --concurrency <number> Number of concurrent processes to use. (default: half of your CPU cores)
-q, --quality <number> Quality of the compressed images [1-100, "max","all" ]. (default: 80)
-w, --width <number> Maximum width of the images in pixels. (default: 1920)
-h, --height <number> Maximum height of the images in pixels. (default: 1080)
-s, --sort <newest|oldest> Determines the order in which the images will be inserted into the PDF. (default: "newest")
--pw, --password <string> Protect file with password.
--cbz Create CBZ file instead of PDF
-V, --version output the cli version number
--help display this help messageExamples
Sets the quality to half of the original:
pdfy -q 50Defines the maximum image resolution:
pdfy -w 1280 -h 720The PDF starts with the oldest images:
pdfy -s oldestProtect file with a password:
pdfy --password 'a1b2c3'NOTE: quotation marks will not be part of the password.
A complete example:
pdfy -c 8 -q 50 -w 1280 -h 720 -s oldest -o F:\images\pdfs --password '1234'Create CBZ file instead of PDF:
pdfy --cbzNOTE: --password doesn't work in CBZ format.
Built with
- sharp - Image manipulation/processing
- bmp-js - Bmp format suport
- pdfkit - PDF manipulation
Development
Source code are located in src/.
Build the CLI with:
bun run buildMake it available on terminal:
bun linkLicense
This project is licensed under the MIT License.
