#!/usr/local/bin/perl
#
# pdf_version       Give you the version of a pdf file
#
# A simple example that use the PDF library
#
# by Antonio Rosella <anface@geocities.com> 10 January 1998
#            http://www.geocities.com/CapeCanaveral/Hangar/4794
#
# Free use under GNU License.
#
# This is the version 1.0
#


use Carp;
use Getopt::Long;
use PDF;

my $version="1.0";
my $help="";
my $verbose="";

GetOptions( "help" => \$help , "verbose" => \$verbose );  

$help and printusage(); 

foreach (@ARGV) {
  do_the_dirty_job_on($_);
}

exit(1);

sub do_the_dirty_job_on {

  my $file = shift;

  my $PDFfile= PDF->new ( $file );

  $verbose && print "file $file is a PDF Version ";
  print $PDFfile->Version,"\n";

}

sub printusage {

print <<ANTRO;

Print out the PDF version used by a ( list of ) PDF file(s) .

usage:
        pdf_version [-options ...] files

where options include:
    -help                        print out this message
    -verbose                     verbose

or the abbreviate version -h, -v 

files:
    with files you can use metacharacters and relative and absolute path name
    
example:
    pdf_version *.pdf
    pdf_version -h
    pdf_version -v . "*.pdf" "/tmp/path/to/work/*.pdf"

ANTRO

exit(1);

}; 
