Sha256: ab22b68ccc812a58d2cbfab4a5375ed17d4c0f58b68d3a9b0163e95923ad5b9e

Contents?: true

Size: 680 Bytes

Versions: 12

Compression:

Stored size: 680 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, 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
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fn_document-0.9.18 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.17 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.16 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.15 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.14 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.13 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.12 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.11 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.10 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.9 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.8 lib/fn/pdf/node/fit_image.rb
fn_document-0.9.7 lib/fn/pdf/node/fit_image.rb