Class: Thumbnailer::PDF
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from Base
#dir, #height, #image_height, #image_width, #prefix, #sequence, #width
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(path, options = {}) ⇒ PDF
constructor
A new instance of PDF.
Methods inherited from Base
Constructor Details
#initialize(path, options = {}) ⇒ PDF
Returns a new instance of PDF.
5 6 7 8 9 10 11 |
# File 'lib/thumbnailer/pdf.rb', line 5 def initialize(path, = {}) super() @path = path @collection = extract_collection @size = @collection.size @format = [:format] || 'png' end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
3 4 5 |
# File 'lib/thumbnailer/pdf.rb', line 3 def collection @collection end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
3 4 5 |
# File 'lib/thumbnailer/pdf.rb', line 3 def format @format end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
3 4 5 |
# File 'lib/thumbnailer/pdf.rb', line 3 def size @size end |
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/thumbnailer/pdf.rb', line 13 def create extract_page extract_pages sequences = extract_sequences @collection.each do |image| sequence = sequences.next image.format(@format, 1) @options[:object] = image @options[:format] = @format @options[:sequence] = sequence file = File.new(@path, @options) file.create end end |