feat: render server-side invoice pdf template using React server

This commit is contained in:
Ahmed Bouhuolia
2024-11-04 12:55:12 +02:00
parent 6687db4085
commit 51aec8d8b3
17 changed files with 787 additions and 70 deletions

View File

@@ -451,14 +451,14 @@ export default class SaleInvoicesController extends BaseController {
ACCEPT_TYPE.APPLICATION_PDF,
]);
// Retrieves invoice in pdf format.
if (ACCEPT_TYPE.APPLICATION_PDF == acceptType) {
if (true) {
const [pdfContent, filename] =
await this.saleInvoiceApplication.saleInvoicePdf(
tenantId,
saleInvoiceId
);
res.set({
'Content-Type': 'application/pdf',
'Content-Type': 'text/html',
'Content-Length': pdfContent.length,
'Content-Disposition': `attachment; filename="${filename}"`,
});