

def pdf_to_txt(self):
    'pdf to txt conversion, use pdftotext command (poppler)'
    path = (os.path.join(os.path.dirname(self.filepath), self.document) + '.txt')
    p = Popen(('pdftotext -enc Latin1 %s %s' % (self.filepath, path)), shell=True, stdout=PIPE, stderr=PIPE)
    (stdout, stderr) = p.communicate()
    content = open(path, 'rb').read()
    p = Popen(('rm -rf %s' % path), shell=True, stdout=PIPE, stderr=PIPE)
    return ['text/plain', content]

dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/libraries/adlibre/converter.py FileConverter.pdf_to_txt/original