pdf to text

Dieter Deyke Dieter_Deyke at CoCreate.com
Thu Jan 25 17:54:54 EST 2007


tubby writes:

> David Boddie wrote:
>
>> The pdftotext tool may do what you want:
>>
>>   http://www.foolabs.com/xpdf/download.html
>>
>> Let us know how you get on with it.
>>
>> David
>
> Perhaps I'm just using pdftotext wrong? Here's how I was using it:
>
> f = filename
>
> try:
>     sout = os.popen('pdftotext "%s" - ' %f)
>     data = sout.read().strip()
>     print data
>     sout.close()
>
> except Exception, e:
>     print e

I am using pdftotext on Windows with cygwin on a regular basis without
any problem.

Your program above should read:

   sout = os.popen('pdftotext "%s" - ' % (f,))

--
Dieter Deyke

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?



More information about the Python-list mailing list