#!/bin/bash # Usage: $0 # Example: $0 foo.png 10 2 => include foo.png 10x per page and make 2 pages set -e set -u img="$1" count="$2" pages="$3" output="$img-$count-$pages" runCmd() { echo "running '$@'" "$@" || true echo "" } # gen test file cat < $output.tex \input test-lfs.tex \includeImage $img $count $pages \end EOT # compile it runCmd ./pdftex -ini $output.tex # validate result ls -lh $output.pdf if which pdftoppm > /dev/null; then echo "check $output.pdf using pdftoppm" runCmd pdftoppm -r 72 $output.pdf $output rm -f '*.ppm' || true fi if which gs > /dev/null; then echo "check $output.pdf using gs" runCmd gs -q -dNOPAUSE -r72 -sDEVICE=ppmraw -sOutputFile=/dev/null -dBATCH $output.pdf fi