pdf2jpg via terminal

less than 1 minute read


How to convert PDF to JPG/PNG (images) via command line prompts on MacOS zsh terminal.

STEP 1 : Install poppler via brew install poppler

STEP 2a : If you only wanna convert one file, run,

pdftoppm -jpeg -r 300 path-to-input-folder/**/*.pdf path-to-output-folder/*

STEP 2b : If you wanna loop through all the files in then execute,

for file in path-to-input-folder/**/*; do pdftoppm -jpeg -r 300 $file path-to-output-folder/*; done;

See also : https://stackoverflow.com/questions/28599346/how-to-loop-through-all-the-files-located-under-a-certain-path-in-zsh