Возможно, это не лучший способ, но вы можете использовать таблицу, чтобы обернуть весь документ и установить его границы.
let docDefinition = {
content: [
{
table: {
body: [[{
stack: [
//you content goes here
]
}]]
},
layout: {
//set custom borders size and color
hLineWidth: function (i, node) {
return (i === 0 || i === node.table.body.length) ? 2 : 1;
},
vLineWidth: function (i, node) {
return (i === 0 || i === node.table.widths.length) ? 2 : 1;
},
hLineColor: function (i, node) {
return (i === 0 || i === node.table.body.length) ? 'black' : 'gray';
},
vLineColor: function (i, node) {
return (i === 0 || i === node.table.widths.length) ? 'black' : 'gray';
}
}
}
]
}
pdfMake.createPdf(docDefinition).open();