[BangPypers] Help in reading the pdf file

Ruchir Shukla ruchiryshukla at gmail.com
Fri Mar 27 12:27:15 CET 2009


 previous was not good sorry.........
i have used this to to read pdf file


import popen2
from StringIO import StringIO
class InputStreamReader(object):

    def __init__(self, inputStream, encoding):

        super(InputStreamReader, self).__init__()
        self.inputStream = inputStream
        self.encoding = encoding or 'utf-8'

    def _read(self, length):

        return self.inputStream.read(length)

    def read(self, length=-1):

        text = self._read(length)
        text = unicode(text, self.encoding)
    return text

    def close(self):

        self.inputStream.close()

process = popen2.Popen4(["pdftotext", "-enc", "UTF-8", 'Full_Path', "-"])
data=InputStreamReader(process.fromchild, 'utf-8').read()
print data
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20090327/9ae98f78/attachment.htm>


More information about the BangPypers mailing list