Pdfmake: Add a separator line in content

Created on 25 May 2017  路  4Comments  路  Source: bpampuch/pdfmake

Between each row in the content array i need to add a separator line.

How can I do it?

Most helpful comment

Such as this example

var dd = {
    content: [
        'First paragraph',
        {canvas: [ { type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 1 } ]},
        'Second paragraph',
        {canvas: [ { type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 1 } ]},
        'Third paragraph',
        {canvas: [ { type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 1 } ]},
    ]
}

All 4 comments

after adding canvas to content array gett4ing:
TypeError: Cannot create property 'resetXY' on string 'line'
at file:///home/anyvision/WebstormProjects/anyvision-dashboard/www/lib/pdfMake/pdfmake.min.js:5:7723
at file:///home/anyvision/WebstormProjects/anyvision-dashboard/www/lib/pdfMake/pdfmake.min.js:3:25261
at lr (file:///home/anyvision/WebstormProjects/anyvision-dashboard/www/lib/pdfMake/pdfmake.min.js:3:15704)
at file:///home/anyvision/WebstormProjects/anyvision-dashboard/www/lib/pdfMake/pdfmake.min.js:3:25066
at Function.ss (file:///home/anyvision/WebstormProjects/anyvision-dashboard/www/lib/pdfMake/pdfmake.min.js:4:8843)
at o (file:///home/anyvision/WebstormProjects/anyvision-dashboard/www/lib/pdfMake/pdfmake.min.js:5:7644)
at i.processNode (file:///home/anyvision/WebstormProjects/anyvision-dashboard/www/lib/pdfMake/pdfmake.min.js:5:11850)
at file:///home/anyvision/WebstormProjects/anyvision-dashboard/www/lib/pdfMake/pdfmake.min.js:5:12995
at Array.forEach (native)
at i.processVerticalContainer (file:///home/anyvision/WebstormProjects/anyvision-dashboard/www/lib/pdfMake/pdfmake.min.js:5:12973)

Such as this example

var dd = {
    content: [
        'First paragraph',
        {canvas: [ { type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 1 } ]},
        'Second paragraph',
        {canvas: [ { type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 1 } ]},
        'Third paragraph',
        {canvas: [ { type: 'line', x1: 0, y1: 0, x2: 515, y2: 0, lineWidth: 1 } ]},
    ]
}

When I use your code between my textblocks, I get this error: pdfmake.js:174 Uncaught Unrecognized document structure: {"type":"line","x1":40,"y1":60,"x2":260,"y2":60,"lineWidth":3}

Canvas type line breaks the UI. it adds extra spaces above the line in PDF

https://stackoverflow.com/q/52046389/5894421

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sayjeyhi picture sayjeyhi  路  3Comments

dgrice picture dgrice  路  3Comments

SummerSonnet picture SummerSonnet  路  3Comments

Masber picture Masber  路  3Comments

davidyeiser picture davidyeiser  路  3Comments