An open API service indexing awesome lists of open source software.

https://github.com/rubyonworld/pdftotext

You must first install Poppler. On OS X this can be done with brew install poppler if you have Homebrew installed
https://github.com/rubyonworld/pdftotext

convert os pdf ruby text

Last synced: 8 months ago
JSON representation

You must first install Poppler. On OS X this can be done with brew install poppler if you have Homebrew installed

Awesome Lists containing this project

README

          

# Pdftotext

*A Ruby wrapper for the `pdftotext` command line library*

[![Build Status](https://travis-ci.org/benbalter/pdftotext.svg)](https://travis-ci.org/benbalter/pdftotext)

## Installation

1. You must first install [Poppler](http://poppler.freedesktop.org/). On OS X this can be done with `brew install poppler` if you have Homebrew installed
2. Add `gem "pdftotext"` to your project's Gemfile
3. `bundle install`

## Usage

```ruby
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`.