Skip to content

Instantly share code, notes, and snippets.

@mlund
mlund / agr2pdf.sh
Created January 12, 2013 09:53
Simplistic shell script to convert xmgrace (.agr files) figures to PDF. White borders will be removed in the conversion process using `pdfcrop`
#!/bin/bash
tmpfile=".tmp.pdf"
if [ $# -ge 1 ]; then
if [ $1 != "-h" ]; then
outfile=`dirname $1`/`basename "$1" \.agr`.pdf
LANG=en xmgrace -hardcopy -hdevice PDF $1 -printfile $tmpfile
pdfcrop $tmpfile $outfile
rm -f $tmpfile
exit
fi