use CAM::PDF; use strict; use warnings; my $filename = 'foo.pdf'; my $pdf = CAM::PDF->new($filename); for my $pagenum (1..$pdf->numPages()) { my $text = $pdf->getPageText(pagenum); if ($text =~ /looking for text/) { print "Found on $pagenum\n"; } }