Skip to content

sujeev/Pdf2img

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby on Rails 4 Paperclip pdf to img Processor

This gem is a simple Paperclip processor which uses rmagick/ImageMagik to convert uploaded pdf files to a image file. This processor supports multiple pages

Requirements

Installation

This gem is written and tested on Ruby on Rails 4 only. However, this could work on other versions as well provided that paperclip and rmagick is working.

In order to install it, add

gem 'pdf2img-paperclip-processor'

to your Gemfile and run

bundle install

in your console. Bundler should take care of all the rest.

or else, you can just download the file and copy it to paperclip processors folder of your project.

rmagick Instalation

Install rmagick from source or using your favorite package manager.

Various Linux distributions should use similar methods with their respected package managers.

Using Processor

Use it as you would any other Paperclip processor. In your model:

class Document < ActiveRecord::Base
  
  has_attached_file :pdf,
          :styles => { :final_doc => {:format => "png"}},
          :processors => [:pdf2img]      

which will convert your pdf document into a png, and keep both files (.png and .pdf) on the server

Release info

Be warned, this gem is released as early beta version. If you are using it you are doing so on your own responsibility.

Have fun with it and drop me a note if you like it.

About

A simple Paperclip processor which uses rmagick to convert uploaded pdf files to a image file. This processor supports multiple paged pdf's

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages