pdf2jpg
Convert PDF files to JPEG images with pdftoppm, support optional page ranges, and bundle generated JPGs into a zip archive for sharing. Use when a user wants...
Latest: v1.0.0
Initial release: convert PDF pages to JPG with pdftoppm, support page ranges, and zip generated images for sharing. Includes dependency checks and installation notes for poppler-utils.
Full description
Convert PDF files to JPEG images with pdftoppm, support optional page ranges, and bundle generated JPGs into a zip archive for sharing. Use when a user wants to turn a PDF into page images, extract selected pages, or package the results. Requires poppler-utils / pdftoppm.
pdf2jpg
Overview
Convert a PDF into JPEG page images using pdftoppm from poppler-utils, then optionally zip the generated JPGs.
Requirements
pdftoppmmust be available inPATH- Install the
poppler-utilspackage before running the scripts
Install poppler-utils
-
Debian / Ubuntu:
bash sudo apt update sudo apt install -y poppler-utils -
Windows:
- Install Poppler via a package manager, then make
pdftoppm.exeavailable in yourPATH - Common options:
winget install -e --id oschwartz10612.Popplerchoco install popplerscoop install poppler
- Install Poppler via a package manager, then make
-
macOS:
bash brew install poppler
Standard workflow
- Convert the PDF with
scripts/pdf2jpg.sh - Bundle the output images with
scripts/zip_jpgs.shif needed
./scripts/pdf2jpg.sh input.pdf
./scripts/pdf2jpg.sh input.pdf 2 5
./scripts/zip_jpgs.sh input.pdf
./scripts/zip_jpgs.sh input.pdf /tmp/output.zip
Scripts
scripts/pdf2jpg.sh
- Prompts for the PDF path if none is supplied
- Verifies the input file exists
- Verifies
pdftoppmis installed and prints apoppler-utilsinstall hint if not - Writes JPEGs beside the PDF using the PDF basename as the output prefix
- Accepts optional
firstandlastpage arguments
scripts/zip_jpgs.sh
- Finds matching
basename-*.jpgfiles for the PDF - Creates a zip archive containing those JPGs
- Uses
${base}-jpgs.zipby default when no output path is supplied
Notes
- Output files follow the
pdftoppmnaming convention, typicallybasename-1.jpg,basename-2.jpg, etc. - If you need different image quality, output naming, or archive behavior, edit the bundled scripts rather than reimplementing the command inline.
