bpampuch / pdfmake

Client/server side PDF printing in pure JavaScript
http://pdfmake.org
Other
11.44k stars 2.02k forks source link

SVG nog showing up when used in header > columns #2690

Closed jdwit closed 4 months ago

jdwit commented 4 months ago

It appears that an SVG is not rendered when used in columns inside the page header:

// playground requires you to assign document definition to a variable called dd
var dd = {
    header: {
            columns: [
                { text: 'text in header and column' },
                { svg: '<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" fill="red"/></svg>' },
                { image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII' }
            ]

    },
    content: [
        'Some',
        'text',
        'here',
        { svg: '<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" fill="red"/></svg>' },
        { 
            columns: [
                'text in column',
                { svg: '<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" fill="red"/></svg>' },
                { image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII' }

            ]
        }

    ]

}

Unfortunately this is an edge case for us and I can see why many users run into this because it is a typical setup where you put a company logo (an SVG) inside of the header and you want it positioned on the right (should be done easily with columns.