#!/usr/bin/perl -w
# usage: pdfTightBBox.pl <file.pdf> [<file.pdf> ...]

# calculates a tight bounding box (using the 'pdfcrop' command) and overwrites the pdf file with the tight bounding box.
for  $inputFileName (@ARGV){
	#$inputFileName=$ARGV[0];

	# now substitute this into file
	$tempFileName="temp_file.eps";
	system("pdfcrop $inputFileName $tempFileName");
	system("mv -v $tempFileName $inputFileName");
}
