Sha256: c3dd2574bdca5c2e7e227b99c8fe036edeadc087f612676ff6468c35cc41206a

Contents?: true

Size: 1.4 KB

Versions: 4

Compression:

Stored size: 1.4 KB

Contents

<pre>
                    ,____
                    |---.\
            ___     |    `
           / .-\  ./=)
          |  |"|_/\/|
          ;  |-;| /_|
         / \_| |/ \ |
        /      \/\( |
        |   /  |` ) |
        /   \ _/    |
       /--._/  \    |
       `/|)    |    /
         /     |   |
       .'      |   |
      /         \  |
     (_.-.__.__./  /
</pre>

h1. Grim

Grim is a simple gem for extracting (reaping) a page from a pdf and converting it to an image as well as extract the text from the page as a string. It basically gives you an easy to use api to ghostscript, imagemagick, and pdftotext specific to this use case.

h2. Prerequisites

You will need ghostscript, imagemagick, and xpdf installed. On the Mac (OSX) I highly recommend using "Homebrew":http://mxcl.github.com/homebrew/ to get them installed.

<pre><code>
  brew install ghostscript imagemagick xpdf
</code></pre>

h2. Installation

<pre><code>
  gem install grim
</code></pre>

h2. Usage

<pre><code>
  pdf   = Grim.reap("/path/to/pdf")         # returns Grim::Pdf instance for pdf
  count = pdf.count                         # returns the number of pages in the pdf
  png   = pdf[3].save('/path/to/image.png') # will return true if page was saved or false if not
  text  = pdf[3].text                       # returns text as a String

  pdf.each do |page|
    puts page.text
  end
</pre></code>

h2. License

See LICENSE for details.

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
grim-0.2.4 README.textile
grim-0.2.3 README.textile
grim-0.2.2 README.textile
grim-0.2.1 README.textile