A Ruby wrapper for the pdftotext
command line library
- You must first install Poppler. On OS X this can be done with
brew install poppler
if you have Homebrew installed - Add
gem "pdftotext"
to your project's Gemfile bundle install
text = Pdftotext.text('path-to.pdf')
=> "The text of the PDF"
pages = Pdftotext.pages('path-to.pdf')
pages.first.number
=> 1
pages.first.text
=> "The text of the PDF"
Both methods take an optional hash of command line arguments to pass to pdftotext
. The only one by default being -layout
.