Hi. So because of large data we have to make template like xlsx file and we set unoconv to pdf. We want to get that file inside afterRender function and to append to main pdf . Problem here is that appendRes is xlsx file and have to be pdf . So we only need to convert xlsx file to pdf inside afterRender func. Does anyone know how to do this ?
This is rendering error :
Report "test_pdf" render failed.
Error when evaluating custom script /obrasci/deo6/test_script.js
Invalid PDF: startxref not found
async function afterRender(req, res) {
let $pdf = await jsreport.pdfUtils.parse(res.content, true)
if ($pdf.pages[0] && $pdf.pages[0].text != null && $pdf.pages[0].text.includes('Main')) {
const appendRes = await jsreport.render({ template: { shortid: 'Cvw4vfrtg'} });
res.content = await jsreport.pdfUtils.append(res.content, appendRes.content);
}
const coverRender = await jsreport.render({ template: { shortid: '_pCbjqGiD' } })
res.content = await jsreport.pdfUtils.prepend(res.content, coverRender.content)
}