Module: FN::PDF::Node::FitImage

Includes:
Node::Base
Defined in:
lib/fn/pdf/node/fit_image.rb

Constant Summary

Constants included from Node::Base

Node::Base::CURRENT_PAGE_HEIGHT, Node::Base::CURRENT_PAGE_WIDTH

Instance Method Summary collapse

Methods included from Node::Base

#classify, #has_no_children, #mixin, #value, #visit_children, #with_attributes_like

Instance Method Details

#visit(struct, debug = false) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/fn/pdf/node/fit_image.rb', line 13

def visit(struct, debug = false)
  has_no_children
  h = attributes.to_h
  img = struct[h.delete("image")]
  x = h.delete("x").to_i
  y = h.delete("y").to_i
  h["scale"] = 0.99 # if h["scale"] == "1.0"
    
  struct.fit_image(img, x, y, h)
end