-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Hi,
I'd like to create tables with bold or italic text only in some cells.
Is this possible?
This is my code. It seems that
font: {
family: 'OpenSans-Italic',
src: `${fontsPath}OpenSans-Italic.ttf`,
},
has no effect.
What am I doing wrong?
const doc = new PDFDocument({
size: 'A4',
bufferPages: true,
margins: { top: margin, right: margin, bottom: margin, left: margin },
layout: 'portrait',
});
doc.registerFont('OpenSans', `${fontsPath}OpenSans-Regular.ttf`);
doc.registerFont('OpenSans-Bold', `${fontsPath}OpenSans-Bold.ttf`);
doc.registerFont('OpenSans-Italic', `${fontsPath}OpenSans-Italic.ttf`);
doc.registerFont('OpenSans-Medium', `${fontsPath}OpenSans-Medium.ttf`);
doc.fontSize(8);
doc.font('OpenSans-Bold').fontSize(12);
doc.table({
defaultStyle: {
border: false,
},
columnStyles: ['*', 200],
data: [
[
{
align: { x: 'left', y: 'top' },
text: `${marker('E-BIKE REPORT')} `,
},
{
font: {
family: 'OpenSans-Italic',
src: `${fontsPath}OpenSans-Italic.ttf`,
},
align: { x: 'right', y: 'top' },
text: moment().format('DD/MM/YYYY'),
},
],
],
});
doc.moveDown(1.0);
Metadata
Metadata
Assignees
Labels
No labels