Class: PdflibWrapper::External::Image::Document
- Inherits:
-
Object
- Object
- PdflibWrapper::External::Image::Document
- Defined in:
- lib/pdflib_wrapper/external/image/document.rb
Constant Summary collapse
- VALID_IMAGE_TYPES =
%Q{bmp ccitt gif jbig2 jpeg jpeg2000 png raw tiff}
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
-
#image_type ⇒ Object
Returns the value of attribute image_type.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(pdf, filepath, opts = {}) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(pdf, filepath, opts = {}) ⇒ Document
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/pdflib_wrapper/external/image/document.rb', line 7 def initialize(pdf, filepath, opts={}) #TODO: support opts if opts[:image_type].nil? || !opts[:image_type].kind_of?(String) || opts[:image_type].empty? || !VALID_IMAGE_TYPES.include?(opts[:image_type]) @image_type = "auto" else @image_type = opts[:image_type] end @pdf = pdf @document = @pdf.load_image(@image_type, filepath, OptionListMapper.('', [], [], opts) ) end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
6 7 8 |
# File 'lib/pdflib_wrapper/external/image/document.rb', line 6 def document @document end |
#image_type ⇒ Object
Returns the value of attribute image_type.
6 7 8 |
# File 'lib/pdflib_wrapper/external/image/document.rb', line 6 def image_type @image_type end |
Instance Method Details
#close ⇒ Object
18 19 20 21 |
# File 'lib/pdflib_wrapper/external/image/document.rb', line 18 def close #TODO: support opts @pdf.close_image(@document) end |