how to return pdf from dynamic xml file .
I was trying to Generate throw without template with xml source but m not able to do so kindly suggest some way
exports.covertHtmlToPDf = [
async function (req, res) {
try {
let jsreportError = '';
let source = JSON.stringify(req.body.data);
logger.info("---Reaching convertHtmlToPdf, printData - " + JSON.stringify(source) + "");
let reportData = {
template: {
content: source,
engine: 'handlebars',
recipe: 'chrome-pdf'
},
};
let res1 = await jsreport.render(reportData).catch((e) => {
jsreportError = e.message;
}).then((out) => {
// console.log("res",JSON.stringify(res))
out.stream.pipe(res);
logger.info("Html successfully converted into pdf.")
});
} catch (err) {
res.end(err);
}
}
]
with above code with post api call