SVG renderer for Prawn Ruby PDF library
// momentum
// why it's here
- Active: last commit today
- Built almost entirely by one person
- Around since 2010 and still shipping
// how to help
// readme
prawn-svg
An SVG renderer for the Prawn PDF library.
This will take an SVG document as input and render it into your PDF, along with whatever else you build with Prawn.
prawn-svg requires Prawn 2.3.0 or later, and Ruby 2.7 or later.
Using prawn-svg
Prawn::Document.generate("test.pdf") do
svg '<svg><rect width="100" height="100" fill="red"></rect></svg>'
end
prawn-svg will do something sensible if you call it with only an SVG document, but you can also
pass the following options to tailor its operation. Unknown options raise ArgumentError.
-
:at
Type:[x, y]Β· Default: none
Location on the page to draw the SVG. -
:position
Type::left,:center,:right, integer Β· Default::left
Horizontal position, if:atisnβt given. -
:vposition
Type::top,:center,:bottom, integer Β· Default: current cursor position
Vertical position, if:atisnβt given. -
:width
Type: integer Β· Default: horizontal space available
Desired width of the SVG. -
:height
Type: integer Β· Default: vertical space available
Desired height of the SVG.