Last active
July 21, 2017 15:00
-
-
Save originalsouth/52b80112ed01f54bdfed130d35866394 to your computer and use it in GitHub Desktop.
Outline pdf images with type 3 fonts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
if [[ $# -eq 0 ]] | |
then | |
echo 'outline_type3.zsh [option/files]' | |
echo 'options:' | |
echo "\t-f\ttoggle overwrite" | |
else | |
overwite=false | |
for file in "$@" | |
do | |
if [[ "$file" == "-f" ]] | |
then | |
overwrite=!$overwite | |
elif [[ $(head -c 4 "$file") = "%PDF" && $(pdffonts $file | grep 'Type 3' | wc -l) -gt 0 ]] | |
then | |
echo "converting $file" | |
output="$(dirname $file)/outlined-${file##*/}" | |
gs -q -o $output -dNoOutputFonts -sDEVICE=pdfwrite $file | |
if [ $overwrite ] | |
then | |
mv -f $output $file | |
fi | |
fi | |
done | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment