cored has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, is a long time im working on a pdf viewer for my linux box, cuz i dont have X here so i need a pdf for console well i made a code that tells me if a file is a pdf or not but i dont know how to parse the text im using the PDF module here is the code i need some help with this thx.
#!/usr/bin/perl use strict; use PDF; foreach(@ARGV){ my $PDFfile=PDF->new( $_ ); if ( $PDFfile->IsaPDF) { print qq(Is a pdf\n); } else { print qq(This is not a pdf file\n); } }

Replies are listed 'Best First'.
Re: PDF Viewer
by behroozi (Beadle) on Jan 05, 2003 at 19:11 UTC
    I cannot comment on usage of the PDF module, but if you have Xpdf installed (as most linux distros seem to do), then you already have an excellent PDF-to-text converter in the "pdftotext" command.
Re: PDF Viewer
by Mr. Muskrat (Canon) on Jan 06, 2003 at 14:57 UTC

    I think PDF::API2 would be better suited for the task at hand.