The following snippit works as expected:
var svg = `
<svg height="100" width="100" xmlns="http://www.w3.org/2000/svg">
<rect height="100" width="100" x="0" y="0" fill="red"></rect>
</svg>
`;
var dd = {
content: [{
svg: svg
}]
};
However, the addition of a <text> element produces a TypeError:
var svg = `
<svg height="100" width="100" xmlns="http://www.w3.org/2000/svg">
<rect height="100" width="100" x="0" y="0" fill="red"></rect>
<text x="0" y="50">Lorem ipsum</text>
</svg>
`;
var dd = {
content: [{
svg: svg
}]
};
Uncaught TypeError: Cannot read property 'encode' of null
at V (source.js:612)
at t (source.js:2284)
at source.js:2376
at new xt (source.js:2193)
at L (source.js:642)
at it.getChildren (source.js:1288)
at it.X.drawChildren (source.js:1382)
at it.Y.drawContent (source.js:1403)
at it.drawInDocument (source.js:1518)
at t.exports.t.exports (source.js:2473)
This occurs both in the application I am building and in the PDFmake playground
Possibly related: https://github.com/alafr/SVG-to-PDFKit/pull/105
Implementation of svg transformation in pdfmake require include standard pdf fonts (see documentation) now, it doesn't work without it. I'll try to fix it.
Fixed by commit https://github.com/bpampuch/pdfmake/commit/b38e439e66a60c21d23d251311c636ed5d4ce7ad (branch 0.1) and https://github.com/bpampuch/pdfmake/commit/98a2dac7eb808b42f6ab9c8c8669902c59f7b8c7 (master).
@liborm85 @bpampuch When will the fix be released ?
Most helpful comment
Fixed by commit https://github.com/bpampuch/pdfmake/commit/b38e439e66a60c21d23d251311c636ed5d4ce7ad (branch 0.1) and https://github.com/bpampuch/pdfmake/commit/98a2dac7eb808b42f6ab9c8c8669902c59f7b8c7 (master).