Skip to content

A ruby gem for converting pdfs to images.

License

Notifications You must be signed in to change notification settings

lounna-team/pdftoimage

 
 

Repository files navigation

pdftoimage

Description

PDFToImage is a ruby gem which allows for conversion of a PDF document into images. It uses poppler_utils to first convert the document to PNG and then allows usage of ImageMagick to convert the image into other formats.

The reasoning behind using poppler_utils is due to the fact that ghostscript occasionally has trouble with certain PDF documents which poppler_utils seems to be able to parse without error.

Examples

require 'pdftoimage'
images = PDFToImage.open('somefile.pdf')
images.each do |img|
  img.resize('50%').save("output/page-#{img.page}.jpg")
end

require 'pdftoimage'
PDFToImage.open('anotherpdf.pdf') do |page|
  page.resize('150').quality('80%').save('out/thumbnail-#{page.page}.jpg")
end

Requirements

poppler_utils

ImageMagick

Install

$ gem install pdftoimage

Copyright © 2018 Rob Flynn

See LICENSE for details.

About

A ruby gem for converting pdfs to images.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%