Render PDF files to JPG but only a certain number of pages / first page
I followed this article and it worked perfectly. Automator - Render multiple PDF as JPG an… - Apple Community (comment from VikingOSX April 13, 2019 11:16am)
However, I only want the first and second page of each file to render, not every single page.
I modified the shell script by adding "PAGEMAX-2" before the script but it didn't work.
OUTDIR="$HOME/Desktop/JPEG/"
for f in "$@"
do
# a by product of the render is generation (nn) sets (e.g. foo nn_01.jpeg) and Ruby removes to make (foo_01.jpeg)
OUTFILE="$(ruby -e 'puts File.basename(ARGV.first).split(/(?<=\s)\d+(?=_)/).map(&:strip).join;' "$f")"
mv "$f" "$OUTDIR$OUTFILE"
done
MacBook Air 13″, macOS 10.15