Skip to content

Instantly share code, notes, and snippets.

@alexrashed
Created September 10, 2019 10:53
Show Gist options
  • Save alexrashed/9495066b0980e6490db17fa28065b125 to your computer and use it in GitHub Desktop.
Save alexrashed/9495066b0980e6490db17fa28065b125 to your computer and use it in GitHub Desktop.
#!/bin/bash
convert () {
drawiofile=$1
file=${drawiofile::-7}
pdffile="${file}.pdf"
echo "Updating $file"
curl --data-urlencode "format=pdf" --data-urlencode "xml@$drawiofile" --output $pdffile https:\//exp.draw.io/ImageExport4/export
pdfcrop $pdffile $pdffile
}
if [ $# -eq 0 ]
then
echo "No specific file given, converting all drawio drawings in the current folder."
for drawiofile in *.drawio
do
convert $drawiofile
done
else
echo "Only converting drawio file $1"
convert $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment