I'm using RedHat Linux, and i am using the Portuguese language. I'm using PDFMake on Linux, and it is not displaying the accents, even with the characters on Linux configured as "pt_br.UTF-8", not working. On Windows, the same PDF generation script is working normally, but on Linux it is not working, as it is not displaying the accents.
Please, could someone help me see if I'm missing any settings in pdfmake?
Here is the header of my code:
let docDefinition = {
pageOrientation: 'portrait',
pageSize: 'A4',
pageMargins: [20, 20, 20, 35],
header: function(page, pages) {
return {
columns: [
{
text: 'Página: ' + page.toString() + ' de ' + pages.toString(),
encoding: 'utf-8',
width: '*',
style: {
fontSize: 8,
alignment: 'right'
}
}
],
margin: [25, 10]
}
},
styles: {
tableExample: {
fontSize: 6,
margin: [0, 0, 0, 0],
border: 0
},
tableHeader: {
bold: true,
fontSize: 6,
color: 'black'
}
},
content: [
{
style: 'tableReport',
table: {
// 1 1b 2 3 4 5 6 7 8 9 10 11 12
widths: [50, 33, 19, 55, 39, 35, 35, 35, 35, 20, 30, 20, 30], // TOTAL: 414
headerRows: 2,
body: []
},
style: {
fontSize: 8
}
}
],
styles: {
tableReport: {
margin: [0, 0, 0, 0],
}
}
};
rows.push(
[
{
image: pathLogo,
colSpan: 5,
width: 85,
alignment: 'left',
border: [true, true, false, false]
},{},{},{},{},
{
colSpan: 6,
rowSpan: 2,
text: [
{
text: '\nCotação de preços',
encoding: 'utf-8',
style: {fontSize: 20}
}
],
alignment: 'center',
style: {bold: true},
border: [true, true, false, false]
},
{},{},{},{},{},
{
text: [
{
text: `Nº\n `,
encoding: 'utf-8',
fontSize: 12, //16
alignment: 'center'
},
{
text: (modelRes['ENTNUM'] || ''),
encoding: 'utf-8',
alignment: 'center',
style: {
bold: true,
fontSize: 12 //16
}
},
{
text: `\n\nEmissão: ${emiCotacao}`,
encoding: 'utf-8',
alignment: 'center',
style: {
bold: true,
fontSize: 10
}
}
],
colSpan: 2,
rowSpan: 2,
border: [true, true, true, false]
},{}
],
);
//[... here I create the rows and columns]
pdfStream(docDefinition, resolve, reject);
Worth checking that the font you have selected supports the accented character you are after.