Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
],
styles: {
header: {
fontSize: 13,
bold: true
},
body: {
fontSize: 8,
bold: false,
preserveLeadingSpaces: true
}
}
};
// create the DocumentReference and generate a PDF
const pdfDocGenerator = pdfMake.createPdf(docDefinition);
//pdfDocGenerator.open();
pdfDocGenerator.getBase64((b64pdf) => {
const documentReference = {
resourceType: "DocumentReference",
status: "current",
type: {
"coding": [
{
"system": "http://loinc.org",
"code": "55107-7",
"display": "Addendum Document"
}
]
},
description: "PDF containing a QuestionnaireResponse",
indexed: new Date().toISOString(),
fontSize: 18,
bold: true
},
item: {
fontSize: 15,
bold: true
},
itemColumn: {
margin: [0, 0, 0, 15]
},
columns: {
columnGap: 15,
}
}
};
pdfMake.createPdf(docDefinitions).download(
[
this.translate.instant('module.title.order').toUpperCase(),
'#',
this.order.id.split('-')[0].toUpperCase()
].join('')
);
}
color: 'black'
}
}
};
await this.orders.forEach((item, i) => {
docDefinitions.content[0].table.body.push([
['#', item.id.split('-')[0]].join(''),
item.order_detail.product.name,
item.customer.full_name,
item.order_detail.amount,
this.currency.set(item.order_detail.product.selling_price).format(this.utils.format),
this.currency.set(item.order_detail.amount * item.order_detail.product.selling_price).format(this.utils.format),
item.created_at,
]);
});
pdfMake.createPdf(docDefinitions).download('orders.pdf');
}
}
}
};
await this.products.forEach((item, i) => {
docDefinitions.content[0].table.body.push([
i + 1,
item.name,
item.sku,
item.type.name,
item.stock,
this.currency.set(item.cost).format(this._utils.format),
this.currency.set(item.selling_price).format(this._utils.format),
(item.stock > 0) ? this.translate.instant('text.in-stock') : this.translate.instant('text.sold-out')
]);
});
pdfMake.createPdf(docDefinitions).download('products.pdf');
}
setTimeout(function () {
pdfMake.createPdf(docDefinition).download(`${name.replace(' ', '')}-${Date.now()}.pdf`);
}, 10);
}