38 lines
763 B
Bash
38 lines
763 B
Bash
#!/bin/bash
|
|
# @Author: jguer
|
|
# @Date: 2016-01-03 00:24:04
|
|
# @Last Modified by: jguer
|
|
# @Last Modified time: 2016-01-03 00:28:57
|
|
|
|
buildroot="$(mktemp -d)"
|
|
mode="$1"
|
|
|
|
if [ -z "$mode" ]
|
|
then
|
|
mode="ebook"
|
|
fi
|
|
|
|
shopt -s nullglob
|
|
|
|
for f in *.{PDF,pdf}; do
|
|
echo "Converting: $f"
|
|
gs -q -dNOPAUSE -dBATCH -dSAFER \
|
|
-dNumRenderingThreads=4 \
|
|
-dBandHeight=100 \
|
|
-dBandBufferSpace=500000000 \
|
|
-dBufferSpace=1000000000 \
|
|
-sBandListStorage=memory \
|
|
-sDEVICE=pdfwrite \
|
|
-dCompatibilityLevel=1.4 \
|
|
-dPDFSETTINGS=/$mode \
|
|
-dDetectDuplicateImages=true \
|
|
-dConvertCMYKImagesToRGB=true \
|
|
-r144 \
|
|
-sOutputFile="${buildroot}/${f}" \
|
|
-sPDFPassword=instrmed \
|
|
-c .setpdfwrite \
|
|
-f "${f}"
|
|
done
|
|
|
|
xdg-open "${buildroot}"
|