Hi guys thank you for stopping by
i have issues with voilab pdf kit a library for PDFkit which essentially helps for arranging the table for NPM Pdfkit.
after successfully generating table, i tried to add a new paragraph but unfortunately my paragraph format were
following row format width and messing up.
let me show you my code to generate table.
doc
.fontSize(14)
.font('Times-Bold')
.text('IKHTISAR POLIS / POLICY SCHEDULE', {
align: 'center',
})
.text('Asuransi TravelFirst Indonesiana', {
align: 'center',
})
.font('Times-BoldItalic')
.text('TravelFirst Indonesiana Insurance', {
align: 'center',
})
.font('Times-Bold')
.moveDown(4);
table
.addBody([
{
Item: 'No. Polis / Policy Number',
Separator: ':',
Description: `${noPolis}`,
},
{
Item: 'Nama / Name',
Separator: ':',
Description: `${paxes.name}`,
},
{
Item: 'TTL / DOB',
Separator: ':',
Description: `${DOBpolis}`,
},
{
Item: 'No. Identitas / Identity Number',
Separator: ':',
Description: `${paxes.id_no}`,
},
{
Item: 'Jenis Perjalanan / Type of Trip',
Separator: ':',
Description: 'Perjalanan Singkat / Short Trip',
},
{
Item: 'Polis Diterbitkan / Policy Issues',
Separator: ':',
Description: `${dateNow}`,
},
{
Item: 'Periode Polis / Policy Period',
Separator: ':',
Description: `${polisStart} - ${polisEnd}`,
},
{
Item: 'Lokasi Asal / Origin Location',
Separator: ':',
Description: `${element.city_origin}`,
},
{
Item: 'Lokasi Tujuan / Destination Location',
Separator: ':',
Description: `${element.city_destination}`,
},
{
Item: 'Paket Pilihan / Selected Package',
Separator: ':',
Description: `${insuranceProduct.name}`,
},
{
Item: 'Jumlah Premi / Total Premi',
Separator: ':',
Description: `${currencyFormatIDR(insuranceProduct.tarif)}`,
},
{
Item: 'Biaya Polis / Total Premium',
Separator: ':',
Description: `${currencyFormatIDR(insuranceProduct.tarif)}`,
},
{
Item: 'Jumlah Premi / Total Premi',
Separator: ':',
Description: `${currencyFormatIDR(insuranceProduct.tarif)}`,
},
]);
doc.moveDown(2);
and here’s my code for add new paragraph after the table
doc
.fontSize(9)
.font('Times-Roman')
.text(tcId, {
align: 'justify',
margin: {
right: 100,
},
});
doc
.fontSize(9)
.font('Times-Italic')
.text(tcEn, {
align: 'justify',
fit: [300, 200],
});
doc
.fontSize(9)
.font('Times-Roman')
.text(`${dateNow}`, {
align: 'right',
fit: [300, 200],
});
I have tried creating another table and put my paragraph inside like this
table
.addColumns([
{
id: 'text',
Align: 'justify',
// width: 500,
}]);
table
.addBody([
{
text: `${tcId}`,
},
{
text: `${tcEn}`,
},
]);
but the result are the same here’s what it looks like after I generate to pdf
thank you for your time any input will be very valuable and appreciated guys thanks,