#!/usr/bin/perl

use XML::Twig;
if (! ARGV) {
    @ARGV = "-";
}
foreach (@ARGV) {
  my $twig=XML::Twig->new(twig_handlers => {
        'i:pgf' => sub {
            if ($_->{'att'}->{'id'} eq 'adobe_illustrator_pgf'){
                $_->delete;
            }
        },
        'i:pgfRef' => sub {
            $_->delete;
        },
        'x:xmpmeta' => sub {
            $_->delete;
        },
        'xpacket' => sub {
            $_->delete;
        }
           
    }
  
  );    # create the twig
  $twig->parsefile($_);        # build it
  open OUTFILE,  "> $_" or die "Can't open $_ : $!";
  $twig->flush (\*OUTFILE);                 # output the twig
  close OUTFILE;
}
