Sha256: 5f113c2778f86a70f865311019eacb140bdbf1b267b4c9fcd51d003ed6b0b640

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

require File.dirname(__FILE__) + "/../../node/base"
require "PDFlib"
module FN
  module PDF
    module Node
      def FitImage(image, x, y, opts = {})
        FN::Node::Base("fit_image", opts.merge(:image => image, :x => x, :y => y)).extend(FitImage)
      end
      
      module FitImage 
        include FN::Node::Base
      
        def visit(struct)
          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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fn_document-0.9.6 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.4 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.3 lib/fn/pdf/node/fit_image.rb