/usr/share/doc/libtext-pdf-perl/examples/pdfgetobj.pl is in libtext-pdf-perl 0.29a-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | use Text::PDF::File;
require 'getopt.pl';
Getopt("g:n:o:");
unless (defined $ARGV[0])
{
die <<'EOT';
PDFGETOBJ [-g gen] -n num [-o outfile] pdffile
Gets the given object from the pdf file and unpacks it to either stdout
or outfile.
-g gen Generation number [0]
-n num Object number
-o outfile Output file
EOT
}
$file = Text::PDF::File->open("$ARGV[0]") || die "Unable to open $ARGV[0]";
$offset = $file->locate_obj($opt_n, $opt_g) || die "Can't find obj $opt_n $opt_g";
seek($file->{' INFILE'}, $offset, 0);
($res, $str) = $file->readval("");
if (defined $opt_o)
{
open(OUTFILE, ">$opt_o") || die "Unable to open $opt_o";
binmode OUTFILE;
select OUTFILE;
}
if (defined $res->{' stream'})
{
print $res->read_stream(1)->{' stream'};
} else
{
print $res->val;
}
close(OUTFILE) if defined $opt_o;
|