Skip to content

Instantly share code, notes, and snippets.

@aermolaev
Created September 30, 2010 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aermolaev/604577 to your computer and use it in GitHub Desktop.
Save aermolaev/604577 to your computer and use it in GitHub Desktop.
Преобразует PDF-документ в текст
# Преобразует 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