SVGs
Minimal version: 0.1.59
SVGs are much like images except it is not currently possible to refer to SVGs by file or re-use from a dictionary.
The SVG node expects a valid SVG value. If the value is invalid or empty, an error is thrown.
Library SVG-to-PDFKit is used to transformation from SVG to PDF document.
var docDefinition = {
content: [
{
// If no width/height/fit is used, then dimensions from the svg element is used.
svg: '<svg width="300" height="200" viewBox="0 0 300 200">...</svg>'
},
{
// if you specify width, svg will scale proportionally
svg: '<svg width="300" height="200" viewBox="0 0 300 200">...</svg>',
width: 150
},
{
// if you specify both width and height - svg will be stretched
svg: '<svg width="300" height="200" viewBox="0 0 300 200">...</svg>',
width: 600,
height: 400
},
{
// you can also fit the svg inside a rectangle
svg: '<svg width="300" height="200" viewBox="0 0 300 200">...</svg>',
fit: [150, 100]
}
};