How are you supposed to create paragraphs in columns? For some reason my text always comes out as a single line and not a paragraph. I noticed this only happens when using columns.
let test = {
content: [
'Standard paragraph 1',
'Standard paragraph 2',
{
columnGap: 30,
alignment: 'justify',
width: '50%',
columns: [
{
text: [
'1. Aliquam facilisis fringilla ipsum. Phasellus sollicitudin felis eu arcu. Suspendisse potenti.',
'2. Aliquam luctus suscipit tellus. In rutrum dignissim nisl.',
'3. Hello',
],
},
{
text: [
'Column 2'
]
}
],
},
]
}
pdfMake.createPdf(test).download('file.pdf');
Which basically looks like this.
Am I missing anything here?
You could use the Array
implementation of columns
:
PS: See the documentation for more examples.
let test = {
content: [
'Standard paragraph 1',
'Standard paragraph 2',
{
columnGap: 30,
alignment: 'justify',
width: '50%',
columns: [
[
'1. Aliquam facilisis fringilla ipsum. Phasellus sollicitudin felis eu arcu. Suspendisse potenti.',
'2. Aliquam luctus suscipit tellus. In rutrum dignissim nisl.',
'3. Hello',
],
'Column 2'
]
},
]
}
pdfMake.createPdf(test).download('file.pdf');