2014-02-13 6 views
0

하나의 pdf에서 여러 이미지를 생성하고 싶습니다.여러 pdf를 여러 이미지로 변환

Heres는 내 논리 :

has_attached_file :single_magazin, 
        :styles => {:for_magazine => ["768x1200>", :jpg], :preview => ["725x1200>", :jpg], :thumb => ["100x140>", :jpg] }, 
        :processors => [:ghostscript, :thumbnail], 

        :convert_options => { :all => '-colorspace RGB -flatten -density 300 -quality 100' }, 

        :path => ":rails_root/public/system/:class/:attachment/:id_partition/:style/:filename" 



    validates_attachment_content_type :single_magazin, 
            :content_type => [ 'application/pdf' ], 
            :error => "only pdf files are allowed" 

내가 여러 페이지를 하나의 PDF를 업로드하려면, 내가 출력 다수의 JPG 년대합니다. 각 페이지를 하나의 JPG로 만듭니다.

내가 레일 4

를 사용하고 난 고스트 스크립트와 ImageMagick이 설치되어 있어야합니다.

도와주세요.

마르쿠스

+0

중복 됨. 확인 : http://stackoverflow.com/questions/25503735/convert-pdf-to-image-as-per-the-pdf-page/ – pedrofs

답변

0

당신은 아마 직접 내가 돈 ImageMagick를 사용하지해야하지만 GS를 사용, t는 ImageMagick이이 작업을 수행 할 충분한 GS 인터페이스를 공개 생각합니다.

Ghostscript에서 -sOutputFile = filename % d.extent를 설정하면 입력 페이지마다 하나의 출력 파일을 씁니다.

관련 문제