Pdfmake: Svg <text> element results in TypeError

Created on 17 Sep 2019  路  4Comments  路  Source: bpampuch/pdfmake

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

bug svg

All 4 comments

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.

@liborm85 @bpampuch When will the fix be released ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dannybrown2710 picture Dannybrown2710  路  33Comments

ghost picture ghost  路  33Comments

andrew-rutherford picture andrew-rutherford  路  22Comments

liborm85 picture liborm85  路  30Comments

hujhax picture hujhax  路  65Comments