I know it has been a while, but I am using this library and am struggling with getting headers and footers generated with a custom module.
Did you manage to get yours generated and would you be willing to share your code?
I am importing mine as a js template and then running the library within wappler.
TIA
wappler code
const fs = require('fs');
const path = require('path');
const PdfPrinter = require('pdfmake');
exports.perdiem = async function (options = {}) {
const filename = this.parseOptional(options.filename, 'output.pdf');
const companyName = this.parseRequired(options.companyName, '*', 'The company name is required');
const companyFiscalID = this.parseRequired(options.companyFiscalID, '*', 'The company fiscal ID is required');
const staffName = this.parseRequired(options.staffName, '*', 'The staff name is required');
const staffFiscalID = this.parseRequired(options.staffFiscalID, '*', 'The staff fiscal ID is required');
const rateNacional = this.parseRequired(options.rateNacional, '*', 'The rate national is required');
const rateInternacional = this.parseRequired(options.rateInternacional, '*', 'The rate international is required');
let template;
try {
// Import JS template
//test js file here "http://pdfmake.org/playground.html"
const templatePath = path.join(process.cwd(), 'public/assets/templates/Perdiem.js');
template = require(templatePath);
console.log('Template imported with sucess');
} catch (error) {
console.error('Error importing template:', error);
throw error;
}
// Clones original template
const docDefinition = JSON.parse(JSON.stringify(template));
// replace template vars
function replaceVars(obj) {
if (typeof obj === 'string') {
return obj
.replace('{{companyName}}', companyName || '')
.replace('{{companyFiscalID}}', companyFiscalID || '')
.replace('{{staffName}}', staffName || '')
.replace('{{staffFiscalID}}', staffFiscalID || '')
.replace('{{rateNacional}}', rateNacional || '')
.replace('{{rateInternacional}}', rateInternacional || '');
} else if (Array.isArray(obj)) {
return obj.map(replaceVars);
} else if (typeof obj === 'object' && obj !== null) {
const newObj = {};
for (const k in obj) {
newObj[k] = replaceVars(obj[k]);
}
return newObj;
}
return obj;
}
const filledDoc = replaceVars(docDefinition);
// font definition
const fonts = {
Roboto: {
normal: path.join(process.cwd(), 'public/assets/fonts/Roboto-Regular.ttf'),
bold: path.join(process.cwd(), 'public/assets/fonts/Roboto-Medium.ttf'),
italics: path.join(process.cwd(), 'public/assets/fonts/Roboto-Italic.ttf'),
bolditalics: path.join(process.cwd(), 'public/assets/fonts/Roboto-MediumItalic.ttf')
}
};
const printer = new PdfPrinter(fonts);
const pdfDoc = printer.createPdfKitDocument(filledDoc);
const chunks = [];
const buffer = await new Promise((resolve, reject) => {
pdfDoc.on('data', chunk => chunks.push(chunk));
pdfDoc.on('end', () => resolve(Buffer.concat(chunks)));
pdfDoc.on('error', err => {
console.error('Erro ao gerar PDF:', err);
reject(err);
});
pdfDoc.end();
});
// Stores file temporarily, to be used in Wappler “File Upload”
const uploadDir = path.join(process.cwd(), 'public/uploads/company/perdiem');
if (!fs.existsSync(uploadDir)) {
fs.mkdirSync(uploadDir, { recursive: true });
}
const { v4: uuidv4 } = require('uuid');
const fileName = `perdiem-${uuidv4()}.pdf`;
const tempPath = path.join(uploadDir, fileName);
fs.writeFileSync(tempPath, buffer);
return {
fileToUpload: {
path: tempPath,
filename: fileName,
contentType: 'application/pdf'
}
};
};
js code
var dd = {
defaultStyle: {
font: 'Roboto'
},
header: function(currentPage, pageCount) {
{
return {
table: {
widths: ['auto', '*', 'auto'],
heights: 50,
body: [
[
{
image: companyImage,
width: 40,
margin: [40, 5, 0, 0],
opacity: 1
},
{
text: '{{companyName}}',
alignment: 'center',
fontSize: 12,
bold: false,
margin: [-200, 19, 0, 0],
opacity: 0.7
},
{
text: 'NIPC {{companyFiscalID}}',
alignment: 'right',
fontSize: 12,
margin: [0, 19, 45, 0],
opacity: 0.7
}
]
]
},
layout: 'noBorders'
};
}
},
footer: function(currentPage, pageCount) {
{
return {
table: {
widths: ['*', 'auto','*'], // coluna esquerda expansiva, direita justa
body: [
[
{
image: DOLogo,
width: 30,
alignment: 'left',
margin: [40, -25, 10, 25],
opacity: 1
},
{
text: 'DigitalOffice',
alignment: 'center',
fontSize: 12,
bold: false,
margin: [-350, -13, 0, 0],
opacity: 0.7
},
{
text: `${currentPage} / ${pageCount}`,
alignment: 'right',
margin: [10, -12, 50, 5],
opacity: 0.7
}
]
]
},
layout: 'noBorders'
};
}
},
content: [
{ text: '\n\n\n'},
{
style: 'tableExample',
color: '#444',
table: {
widths: [510, '*', 200,'*'],
headerRows: 1,
body: [
[
{
text: 'Ajudas de Custo',
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'center',
fontSize: 20,
bold: true,
},
],
[
{
text:'',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
}
],
],
},
},
{
text: '\n<Ano> / <Mês>',
style: 'header',
fontSize: 20,
bold: true,
alignment: 'right',
},
{ text: ' ', style: 'header'},
{
style: 'tableExample',
color: '#444',
table: {
widths: [90, '*', 120],
headerRows: 1,
// keepWithHeaderRows: 1,
body: [
[
{
text: 'Colaborador',
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'left',
fontSize: 15,
bold: true
},
{
text: '{{staffName}}',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'right',
fontSize: 13,
bold: false
},
{
text: 'NIF {{staffFiscalID}}',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'right',
fontSize: 13,
bold: false
},
],
],
},
},
{
text: '\n\n\n\n',
style: 'header',
fontSize: 8,
},
{
style: 'tableExample',
color: '#444',
table: {
widths: [510, '*', 200,'*'],
headerRows: 1,
body: [
[
{
text: [
{ text: 'Resumo ', fontSize: 14, bold: true },
{ text: '(mensal)', fontSize: 10, italics: true }
],
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'center'
},
],
[
{
text:'',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
}
],
],
},
},
{
text: '\n\n',
style: 'header',
fontSize: 11,
bold: true
},
{
style: 'tableExample',
color: '#444',
table: {
widths: [80, 80, 80, 80,80,'*'],
headerRows: 1,
// keepWithHeaderRows: 1,
body: [
[
{
text: 'Nacional',
style: 'tableHeader',
borderColor: ['#ffffff', '#ffffff', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 11,
bold: true
},
{
text: '100%',
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '75%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '50%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '25%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: 'Total',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
],
[
{
text: 'Dias',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
[
{
text: 'Reembolso',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
],
},
},
{
text: '\n\n',
style: 'header',
fontSize: 11,
bold: true
},
{
style: 'tableExample',
color: '#444',
table: {
widths: [80, 80, 80, 80,80,'*'],
headerRows: 1,
// keepWithHeaderRows: 1,
body: [
[
{
text: 'Internacional',
style: 'tableHeader',
borderColor: ['#ffffff', '#ffffff', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 11,
bold: true
},
{
text: '100%',
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '75%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '50%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '25%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: 'Total',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
],
[
{
text: 'Dias',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
[
{
text: 'Reembolso',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
],
},
},
{
text: '\n\n',
style: 'header',
fontSize: 10,
bold: true
},
{
style: 'tableExample',
color: '#444',
table: {
widths: [510, '*', 200,'*'],
headerRows: 1,
body: [
[
{
text: 'Total',
style: 'tableHeader',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#0cccc0'],
alignment: 'center',
fontSize: 14,
bold: true,
},
],
[
{
text:'',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
}
],
],
},
},
{
text: '\n',
style: 'header',
fontSize: 10,
bold: true
},
{
style: 'tableExample',
color: '#444',
table: {
widths: [80, 80, 80, 80,80,'*'],
headerRows: 1,
// keepWithHeaderRows: 1,
body: [
[
{
text: 'Nac. + Int.',
style: 'tableHeader',
borderColor: ['#ffffff', '#ffffff', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 11,
bold: true
},
{
text: '100%',
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '75%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '50%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '25%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: 'Total',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
],
[
{
text: 'Dias',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
[
{
text: 'Reembolso',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
],
},
},
{
text: '\n\n\n\n\n\n\n\n',
style: 'header',
fontSize: 8,
},
{
text: '\n______________________________________________________________________________________________________________________________________________',
style: 'header',
fontSize: 8,
opacity: 0.5,
},
{
text: [
{ text: '\nElaborado nos termos e para os efeitos do ', fontSize: 8, bold: false,opacity: 0.5 },
{ text: 'ART. 2.º N.º 3 Alínea d) do Código do IRS e Ard. 23.º N.º 1 Alínea d) do Código do IRC.\n', fontSize: 8,opacity: 0.5 },
{ text: '\nAbonos respeitantes a deslocações no país e ao estrangeiro, para assistência a clientes, prospecção e realização dos\n', fontSize: 8,opacity: 0.5 },
{ text: 'proveitos e manutenção da fonte produtora.', fontSize: 8,opacity: 0.5 },
]
},
{
text: '______________________________________________________________________________________________________________________________________________',
style: 'header',
fontSize: 8,
opacity: 0.5,
},
{
text: '\nValores para Ajudas de Custo no ano vigente: No país: {{rateNacional} € | No estrangeiro: {{rateInternacional}} €',
style: 'header',
fontSize: 8,
opacity: 0.5,
},
{
text: '______________________________________________________________________________________________________________________________________________',
style: 'header',
fontSize: 8,
opacity: 0.5,
},
//page break - trip detail follows
{ text: '', pageBreak: 'after' },
{ text: '\n\n', style: 'header'},
{
style: 'tableExample',
color: '#444',
table: {
widths: [510, '*', 200,'*'],
headerRows: 1,
body: [
[
{
text: [
{ text: 'Detalhe ', fontSize: 14, bold: true },
{ text: '(por viagem)', fontSize: 10, italics: true }
],
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'center'
},
],
[
{
text:'',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
}
],
],
},
},
{ text: '\n', style: 'header'},
{
style: 'tableExample',
color: '#444',
table: {
widths: [61, 102, 102,102,102],
headerRows: 1,
// keepWithHeaderRows: 1,
body: [
[
{
text: '# dias',
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: 'Data de início',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: 'Data de Fim',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: 'Hora de início',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: 'Hora de Fim',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
],
[
{
text: '#NUMDIAS#',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
],
},
},
{
text: ' ',
style: 'header',
fontSize: 8,
},
{
style: 'tableExample',
color: '#444',
table: {
widths: [61,213, '*'],
headerRows: 1,
// keepWithHeaderRows: 1,
body: [
[
{
text: ' ',
style: 'tableHeader',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: 'País',
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: 'Localidade(s)',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
],
[
{
text: ' ',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#ffffff', '#ffffff', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
],
},
},
{
text: ' ',
style: 'header',
fontSize: 8,
},
{
style: 'tableExample',
color: '#444',
table: {
widths: [61,213, '*'],
headerRows: 1,
// keepWithHeaderRows: 1,
body: [
[
{
text: ' ',
style: 'tableHeader',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: 'Descrição do serviço\n(direito a ajudas de custo)',
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: 'Notas',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
],
[
{
text: ' ',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#ffffff', '#ffffff', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
],
},
},
{
text: ' ',
style: 'header',
fontSize: 8,
},
{
style: 'tableExample',
color: '#444',
table: {
widths: [61,65, 65, 65, 65,65,'*'],
headerRows: 1,
// keepWithHeaderRows: 1,
body: [
[
{
text: '',
style: 'tableHeader',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: '',
style: 'tableHeader',
borderColor: ['#ffffff', '#ffffff', '#0cccc0', '#0cccc0'],
alignment: 'left',
fontSize: 12,
bold: true
},
{
text: '100%',
style: 'tableHeader',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '75%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '50%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: '25%',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
{
text: 'Total',
style: 'tableHeader',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
alignment: 'center',
fontSize: 12,
bold: true
},
],
[
{
text: '',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
fontSize: 10,
bold: false
},
{
text: 'Dias',
borderColor: ['#ffffff', '#ffffff', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#ffffff', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '---',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
[
{
text: '',
borderColor: ['#ffffff', '#ffffff', '#ffffff', '#ffffff'],
fontSize: 10,
bold: false
},
{
text: 'Reembolso',
borderColor: ['#ffffff', '#ffffff', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#ffffff', '#ffffff', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#0cccc0', '#0cccc0'],
fontSize: 10,
bold: false
},
{
text: '--- €',
borderColor: ['#0cccc0', '#0cccc0', '#ffffff', '#0cccc0'],
fontSize: 10,
bold: false
}
],
],
},
},
{
text: '\nAprovado digitalmente em <dd/mm/yyyy>, por <NomeAprovador>',
style: 'header',
alignment: 'right',
fontSize: 8,
opacity: 0.5,
},
]
}
module.exports = dd;