Pdfmake: Text inside canvas

Created on 18 Aug 2016  Â·  5Comments  Â·  Source: bpampuch/pdfmake

I want to print text with in a rectangular box. I am seeing canvas option (type: 'rect') which lets us to draw rectangles.

        {
            canvas: [
                {
                    type: 'rect',
                    x: 1,
                    y: 10,
                    w: 250,
                    h: 100,
                    r: 4,
                    lineColor: '#000',
                }
                               ]
              }

How to write text inside it? Or is the anyway to specify coordinates for text?

Most helpful comment

+1

Something like this - inside "canvas": [] - would be great!

                   {
                        type: "text",
                        x: 0,
                        y: 0,
                        font: '36pt Arial',
                        fillStyle: '#3F51B5',
                        text: 'My TEXT'
                    }

Any idea for a "workaround"? custom function from reply â„–5 #74 does not help. Just have to print some Numbers & Text inside a canvas. Basically to create some "charts".

All 5 comments

+1

try this custom function from reply â„–5 https://github.com/bpampuch/pdfmake/issues/74

+1

Something like this - inside "canvas": [] - would be great!

                   {
                        type: "text",
                        x: 0,
                        y: 0,
                        font: '36pt Arial',
                        fillStyle: '#3F51B5',
                        text: 'My TEXT'
                    }

Any idea for a "workaround"? custom function from reply â„–5 #74 does not help. Just have to print some Numbers & Text inside a canvas. Basically to create some "charts".

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

einfallstoll picture einfallstoll  Â·  3Comments

dmatesic picture dmatesic  Â·  3Comments

kumarandena picture kumarandena  Â·  3Comments

michaelqiji picture michaelqiji  Â·  3Comments

Masber picture Masber  Â·  3Comments