blob: 971ccd3fdd5a128f49e3d483c5e886e1fc733b77 [file] [log] [blame]
Marc Kupietzce1aa0c2023-06-15 07:50:23 +02001#!/bin/sh -eu
2in=$1 out=$2 page0=${3:-} page1=${4:-$page0}
3${CHROME:-chromium-browser} --no-sandbox --headless --disable-gpu \
4 --run-all-compositor-stages-before-draw \
5 --no-pdf-header-footer --print-to-pdf="$out" "$in"
6GS_ARGS=
7if [ -n "$page0" ]; then
8 GS_ARGS="-dFirstPage=$page0 -dLastPage=$page1"
9fi
10gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH $GS_ARGS -sOutputFile="$2.tmp" "$2"
11mv "$2.tmp" "$2"