My personal configuration files and scripts.
1#!/usr/bin/env bash
2
3# This script converts PDF files and regenerates them through GhostScript to /hopefully/
4# correct any errors and reduce the file size.
5#
6# TODO: Generate PDF/A files.
7
8if ! [[ -x $(command -v gs) ]]; then
9 {
10 echo "Error: the gs command was not found!"
11 echo "Please ensure that GhostScript is installed."
12 } >&2
13 exit 1
14fi
15
16gs \
17 -sOutputFile="$2" \
18 -sDEVICE="pdfwrite" \
19 -sColorConversionStrategy="RGB" \
20 -dCompatibilityLevel=1.7 \
21 -dFastWebView \
22 -dPDFSETTINGS/ebook \
23 -dNOPAUSE \
24 -dBATCH \
25 -dQUIET \
26 "$1"
27
28# vim: ft=bash