Shave pages off of PDFs as images
Ruby C++ C
Latest commit f675293 May 29, 2016 @knowtheory knowtheory Merge pull request #8 from DavidLemayian/patch-1
Use latest commit for OS X install


Shave pages off of PDFs as images.


require 'pdfshaver'
# open a document!
document ='./path/to/document.pdf')
# Iterate through its pages
landscape_pages ={ |page| page.aspect > 1 }
landscape_pages.each{ |page| page.render("./page_#{page.number}.gif") }

copyright 2015 Ted Han, Nathan Stitt & DocumentCloud


PDFShaver is distributed as a Ruby gem. Once you have its dependencies installed, all you have to do is type gem install pdfshaver (although in some cases you'll need to stick a sudo before the command).

PDFShaver depends on Google Chrome's PDFium library, and, for now, installing PDFium takes a little bit of doing.

Getting PDFium and FreeImage

On Ubuntu/Debian

We've built a .deb that you can download and install like so:

wget ''
sudo dpkg -i libpdfium-dev_20151208.015427_amd64.deb

And install FreeImage and FreeType:

sudo apt-get install libfreeimage-dev libfreetype6-dev


You can use homebrew to install pdfium's current code using our Homebrew formula:

brew install --HEAD

Then install FreeImage:

brew install freeimage

On Windows

Unfortunately, we don't have a Windows package yet.

On other Linux/Unix systems

Sorry we don't have a release for your OS but we'd be happy to talk to you about how we packaged PDFium for OSX and Ubuntu if you'd like to help package PDFium for your distribution/os!

Install PDFShaver

gem install pdfshaver (you may have to use sudo gem instead of just gem)