File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
77warrant a full blog post. These are mostly things I learn by pairing with
88smart people at [ Hashrocket] ( http://hashrocket.com/ ) .
99
10- _ 339 TILs and counting..._
10+ _ 340 TILs and counting..._
1111
1212---
1313
@@ -236,6 +236,7 @@ _339 TILs and counting..._
236236- [ Comparing Arrays In RSpec] ( ruby/comparing-arrays-in-rspec.md )
237237- [ Construct A Constant From A String] ( ruby/construct-a-constant-from-a-string.md )
238238- [ Create an Array of Stringed Numbers] ( ruby/create-an-array-of-stringed-numbers.md )
239+ - [ Create Thumbnail Image For A PDF] ( ruby/create-thumbnail-image-for-a-pdf.md )
239240- [ Defaulting To Frozen String Literals] ( ruby/defaulting-to-frozen-string-literals.md )
240241- [ Destructuring Arrays In Blocks] ( ruby/destructuring-arrays-in-blocks.md )
241242- [ Disassemble Some Codes] ( ruby/disassemble-some-codes.md )
Original file line number Diff line number Diff line change 1+ # Create Thumbnail Image For A PDF
2+
3+ The [ ` rmagick ` ] ( https://rmagick.github.io/ ) gem is a wrapper around the
4+ [ ImageMagick] ( http://www.imagemagick.org/script/index.php ) software suite.
5+ This gem can be used to create a thumbnail image of a PDF using the
6+ following snippet of code.
7+
8+ ``` ruby
9+ require ' rmagick'
10+ pdf = Magick ::ImageList .new (' document.pdf' )
11+ first_page = pdf.first
12+ scaled_page = first_page.scale(300 , 450 )
13+ scaled_page.write(' document-thumbnail.jpg' )
14+ ```
15+
16+ The scale can be adjust as necessary to the use case.
17+
18+ [ source] ( http://stackoverflow.com/questions/65250/convert-a-doc-or-pdf-to-an-image-and-display-a-thumbnail-in-ruby )
You can’t perform that action at this time.
0 commit comments