Click here to get back home

How to read a pdf file using active perl?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How to read a pdf file using active perl? johny 08-28-2006
Posted by johny on August 28, 2006, 9:21 am
Please log in for more thread options
Hi,
I am trying to read a PDF file using active Perl. I tried with
PDF::API2 but no use. For example - I should get the text which is on
the third line of first page...

or

Is there any way where I can save the pdf file as a .txt file and then
read the file?
Please help........

Thanks,
AJ


Posted by David Squire on August 28, 2006, 9:45 am
Please log in for more thread options
johny wrote:
> Hi,
> I am trying to read a PDF file using active Perl. I tried with
> PDF::API2 but no use. For example - I should get the text which is on
> the third line of first page...
>
> or
>
> Is there any way where I can save the pdf file as a .txt file and then
> read the file?
> Please help........

Do you need to use Perl? There is the command-line utility pdftotext
that is available on most UNIX-like systems (and no doubt cygwin).

You need to be aware that there is no guarantee that you can get text
out of a PDF document. The PDF standard allows arbitrary encodings to be
used, so you would have to know what the glyph names mean to reconstruct
the text. In some cases the glyph names are not meaningful. See
http://www.glyphandcog.com/textext.html

That being said, pdftotext works in the great majority of cases.


DS

Similar ThreadsPosted
-d file test using Active State PERL under Windows October 7, 2004, 10:58 am
PERL can't open file for logging (world writable directory Windows XP Home/ Active Perl / Apache) November 8, 2006, 5:50 pm
Read xml file and write data to a txt file using PERL.... urgent April 17, 2007, 4:17 pm
Help for the perl read file August 2, 2005, 2:48 pm
How to open and read pdf file in Perl. April 28, 2007, 9:51 am
Perl read file eat up my memory... June 1, 2008, 2:41 pm
How to read access database file with perl? November 16, 2004, 12:50 am
How do I read a GZipped UTF-8 file from Perl on Windows? May 29, 2007, 4:24 pm
How to resolve parameter read from text file in perl script February 9, 2005, 8:16 am
Active State Perl July 26, 2005, 7:41 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap