Created
September 30, 2010 13:35
-
-
Save aermolaev/604577 to your computer and use it in GitHub Desktop.
Преобразует PDF-документ в текст
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Преобразует PDF-документ в текст | |
def attachment2text(attach) | |
content = '' | |
if attach.content_type == 'application/pdf' | |
command = "pdftotext -q -eol unix -enc UTF-8 -nopgbrk \"#{attach.full_filename}\" -" | |
content = `#{command}` | |
end | |
content | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment