Class: Consolidate::Docx::ImageReferenceNodeBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/consolidate/docx/image_reference_node_builder.rb

Instance Method Summary collapse

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/consolidate/docx/image_reference_node_builder.rb', line 13

def call
  usable_width, usable_height = usable_dimensions_from(document)
  scaled_width, scaled_height = scale_dimensions(image.width_in_emu, image.height_in_emu, usable_width, usable_height)

  Nokogiri::XML::Node.new("w:drawing", document).tap do |drawing|
    drawing["xmlns:a"] = "http://schemas.openxmlformats.org/drawingml/2006/main"
    drawing << create_inline_node(scaled_width, scaled_height)
  end
rescue => ex
  puts ex.backtrace
end