Skip to content

Instantly share code, notes, and snippets.

@chocolatkey
Created November 29, 2016 19:50
Show Gist options
  • Save chocolatkey/3e99faaf99135903a6a59b123afccb6e to your computer and use it in GitHub Desktop.
Save chocolatkey/3e99faaf99135903a6a59b123afccb6e to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "-------------------------------"
echo "| OxfordOrb by chocolatkey |"
echo "-------------------------------"
rm -R -- */ # Clean slate
for f in *.orb; do unzip -d "${f%*.orb}" "$f"; done
for D in *; do
if [ -d "${D}" ]; then
echo "${D}"
cd "${D}"
pwd
echo Rename gau to swf and leading zeros (warning: max 999!)
for a in [0-9]*.gau; do
b=$(printf %03d.swf ${a%.gau})
if [ $a != $b ]; then
mv $a $b
fi
done
echo -------------------------------
#Convert SWFs to PDFs
echo Converting SWFs to PDFs
for f in "$PWD"/*.swf
do
filename=${f//$PWD\//}
echo Converting $filename
gfx2gfx ${f//$PWD\//} -r 300 -o ${filename%.*}.pdf #\"$f\" #300 DPI upper limit
done
echo -------------------------------
#Combine PDF pages
COMD="pdfunite "
for f in "$PWD"/*.pdf
do
echo ${f//$PWD\//}
COMD+=$(basename "$f")
COMD+=" "
done
COMD+=\"${PWD##*/}.pdf\"
echo Executing: $COMD
eval $COMD
#echo Generating compressed file
#-r150
#gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dBATCH -dDetectDuplicateImages -dCompressFonts=true -r96 -sOutputFile=FINAL.pdf FINAL_ORIG.pdf
# For some reason this messes up the fonts of the gfx2gfx fork output, it's really weird
#echo Generating picture PDF
#convert -verbose -density 150 -trim FINAL_ORIG.pdf -quality 100 -sharpen 0x1.0 FINAL_PIC.pdf
echo -------------------------------
echo Removing remainders...
for a in [0-9]*.pdf; do
rm -f $a
done
for a in [0-9]*.swf; do
rm -f $a
done
echo DONE
cd ..
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment