Created
August 3, 2014 05:52
-
-
Save tadyjp/95da91cd8d2d28ee48ec to your computer and use it in GitHub Desktop.
CentOS6 + RMagickでPDFをPNGに変換するための準備 ref: http://qiita.com/tady/items/fb6927f9b0031c36332b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su - | |
yum remove ImageMagick* ghostscript* | |
cd /usr/local/src | |
wget http://downloads.ghostscript.com/public/ghostscript-9.07.tar.gz | |
tar zxvf ghostscript-9.07.tar.gz | |
./configure | |
make | |
make install | |
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz | |
tar zxvf ImageMagick.tar.gz | |
./configure | |
make | |
make install | |
vim /etc/profile.d/rmagick.sh | |
export LD_LIBRARY_PATH=/usr/local/lib/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ convert sample.pdf[0] sample.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bundle install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadError: libMagickCore-6.Q16.so.2: cannot open shared object file: No such file or directory - /var/www/sample/shared/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/rmagick-2.13.3/RMagick2.so | |
/var/www/sample/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require' | |
/var/www/sample/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require' | |
/var/www/sample/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency' | |
/var/www/sample/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require' | |
/var/www/sample/shared/bundle/ruby/2.1.0/gems/rmagick-2.13.3/lib/RMagick.rb:11:in `<top (required)>' | |
/var/www/sample/releases/20140803054150/config/application.rb:7:in `<top (required)>' | |
/var/www/sample/releases/20140803054150/Rakefile:4:in `require' | |
/var/www/sample/releases/20140803054150/Rakefile:4:in `<top (required)>' | |
(See full trace by running task with --trace) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file = params[:file] | |
pdf = Magick::ImageList.new(file.path + '[0]') #=> 1ページ目のみ抽出 | |
cover_tmp = Rails.root.join('public', file.original_filename) | |
pdf[0].write(cover_tmp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'rmagick', :require => 'RMagick' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ convert sample-slide.pdf[0] sample-slide.png | |
**** Warning: File has an invalid xref entry: 70. Rebuilding xref table. | |
Error: /limitcheck in --run-- | |
Operand stack: | |
--dict:6/15(L)-- C1 1 --dict:5/5(L)-- --dict:5/5(L)-- HWTTNI+HiraKakuPro-W6 --dict:11/12(ro)(G)-- --nostringval-- CIDFontObject --dict:7/7(L)-- 47182 --dict:7/7(L)-- --dict:5/13(L)-- --nostringval-- --nostringval-- 508369 373655 | |
Execution stack: | |
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1862 1 3 %oparray_pop 1861 1 3 %oparray_pop 1845 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- %loop_continue --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- --nostringval-- | |
Dictionary stack: | |
--dict:1157/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:106/127(ro)(G)-- --dict:286/300(ro)(G)-- --dict:24/25(L)-- --dict:4/6(L)-- --dict:21/40(L)-- --dict:3/5(L)-- --dict:6/15(L)-- --dict:54/106(ro)(G)-- --dict:21/30(L)-- | |
Current allocation mode is local | |
GPL Ghostscript 8.70: Unrecoverable error, exit code 1 | |
convert: Postscript delegate failed `sample-slide.pdf': No such file or directory @ pdf.c/ReadPDFImage/611. | |
convert: missing an image filename `sample-slide.png' @ convert.c/ConvertImageCommand/2800. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment