Skip to content

Conversation

tzafrir0hasadna01
Copy link

Currently there is an attempt to extract text from an attachment using antiword (assuming it is a Word document).

In this change the type of the file (the extension) is considered, and antiword is only run on 'doc' documents.

The text of PDf documents is extracted using the command-line tool pdftotext (In Debian: of the package poppler-utils, generally: included the the library poppler).

I looked at several existing Python binding (Except the poppler ones, that pull a large tree of dependencies: either QT or Cairo), and those don't seem to work. pdftotext returns the full text of the page. Separating to pages later should be possible by splitting on 0xC (form-feed) characters.

Tzafrir Cohen added 2 commits February 23, 2018 16:23
Allow passing the name of the extension if protocol object was
created with get_from_file().
* Use pdftotext (program from poppler-utils) to extract text from PDF
  files.
* Don't try to extract text from files that don't have a '.doc'
  extension.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant