def pdf_to_txt(self):
        #path = '%s/%s.txt' % (os.path.dirname(self.filepath), self.document)
        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]
pdf to txt conversion, use pdftotext command (poppler)
dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/libraries/adlibre/converter.py/FileConverter.pdf_to_txt