Skip to content

Instantly share code, notes, and snippets.

@diablowu
Created November 16, 2015 07:44
Show Gist options
  • Select an option

  • Save diablowu/ae4cf4026524a57bed99 to your computer and use it in GitHub Desktop.

Select an option

Save diablowu/ae4cf4026524a57bed99 to your computer and use it in GitHub Desktop.
pdf2tiff
#!/bin/bash
target=$1
tarball="ghostscript-9.15-linux-x86_64"
if [ -d "$target" ];
then
echo "the path $target is exist, can't install the file into it."
exit 0
fi
echo "the files will be installed into $target"
mkdir -p $target
tar -xzvf "./${tarball}.tgz" -C $target
ln -sf "${target}/${tarball}" "${target}/ghostscript"
ln -sf "${target}/ghostscript/gs-915-linux_x86_64" "${target}/ghostscript/gs"
targetcli="${target}/ghostscript/gs"
#echo $targetcli
cliss=`echo $targetcli|sed 's#\/#\\\/#g'`
#echo $cliss
ss="s#{gscli}#$cliss#g"
#echo $ss
cat ./pdf2tiff.tpl|sed $ss > ${target}/pdf2tiff.sh
chmod +x ${target}/pdf2tiff.sh
exit
#!/bin/bash
gscli={gscli}
pdf=$1
target=$2
prefix=$3
output="${target}/${prefix}_%02d.tif"
$gscli -q -dBATCH \
-o $output \
-sDEVICE=tiffg4 \
-r150 \
$pdf
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment