Sha256: 89468d27f546edc3e6c41134799be414a93ed6f12a98fe9af1f756f9148e3420

Contents?: true

Size: 777 Bytes

Versions: 6

Compression:

Stored size: 777 Bytes

Contents

module Prawn
  module Svg
    module Extension
      #
      # Draws an SVG document into the PDF.
      #
      # +options+ must contain the key :at, which takes a tuple of x and y co-ordinates.
      #
      # +options+ can optionally contain the key :width or :height.  If both are 
      # specified, only :width will be used.  If neither are specified, the resolution
      # given in the SVG will be used.
      #
      # Example usage:
      #
      #   svg IO.read("example.svg"), :at => [100, 300], :width => 600
      #
      def svg(data, options={})
        svg = Prawn::Svg::Interface.new(data, self, options)
        svg.draw
        {:warnings => svg.document.warnings, :width => svg.document.width, :height => svg.document.height}
      end  
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
prawn-svg-0.12.0.3 lib/prawn/svg/extension.rb
prawn-svg-0.12.0.2 lib/prawn/svg/extension.rb
prawn-svg-0.12.0.1 lib/prawn/svg/extension.rb
prawn-svg-0.9.1.11 lib/prawn/svg/extension.rb
prawn-svg-0.9.1.10 lib/prawn/svg/extension.rb
prawn-svg-0.9.1.9 lib/prawn/svg/extension.rb