Sha256: 44561708e04c6fcbafdc08a2bb0c3b4a4ae67c8eed1ec036177f3fe87ace28da

Contents?: true

Size: 820 Bytes

Versions: 8

Compression:

Stored size: 820 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 = {}, &block)
        svg = Prawn::Svg::Interface.new(data, self, options, &block)
        svg.draw
        {:warnings => svg.document.warnings, :width => svg.document.sizing.output_width, :height => svg.document.sizing.output_height}
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
prawn-svg-0.21.0 lib/prawn/svg/extension.rb
prawn-svg-0.20.0 lib/prawn/svg/extension.rb
prawn-svg-0.19.0 lib/prawn/svg/extension.rb
prawn-svg-0.18.0 lib/prawn/svg/extension.rb
prawn-svg-0.17.0 lib/prawn/svg/extension.rb
prawn-svg-0.16.2 lib/prawn/svg/extension.rb
prawn-svg-0.16.1 lib/prawn/svg/extension.rb
prawn-svg-0.16.0 lib/prawn/svg/extension.rb