-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Following is the code used to render the pdf report
exports.renderReport_ICE = function(req, res){
var finalReports = req.body.finalreports;
var reportType = req.body.reporttype;
var shortId;
if(reportType == "html") shortId = "rkE973-5l";
else shortId = "H1Orcdvhg";
var client = require("jsreport-client")("http://"+IP+":3001/");
client.render({
template: {
shortid: shortId,
recipe: reportType,
engine: "handlebars"
},
data: {
"overallstatus": finalReports.overallstatus,
"rows": finalReports.rows
}
}, function(err, response) {
if (err) {
console.log('error when trying to render report:', err);
}
else{
response.pipe(res);
}
});
}
My angular code is,
reportService.renderReport_ICE(finalReports, reportType)
.then(function(data1) {
var path = "/specificreports";
openWindow = 0;
if(openWindow == 0)
{
var myWindow = window.open();
myWindow.document.write(data1);
//myWindow.location.hash = path;
}
openWindow++;
e.stopImmediatePropagation();
$('.formatpdfbrwsrexport').remove();
},
function(error) {
console.log("Error-------"+error);
})
Following is the UTF displayed in the browser
%PDF-1.4 1 0 obj << /Title (��) /Creator (��) /Producer (��Qt 4.8.4 (C) 2011 Nokia Corporation and/or its subsidiary(-ies)) /CreationDate (D:20170328144424+05'30') >> endobj 3 0 obj << /Type /ExtGState /SA true /SM 0.02 /ca 1.0 /CA 1.0 /AIS false /SMask /None>> endobj 4 0 obj [/Pattern /DeviceRGB] endobj 5 0 obj << /Type /Page /Parent 2 0 R /Contents 8 0 R /Resources 10 0 R /Annots 11 0 R /MediaBox [0 0 595 842] >> endobj 10 0 obj << /ColorSpace << /PCSp 4 0 R /CSp /DeviceRGB /CSpg /DeviceGray >> /ExtGState << /GSa 3 0 R >> /Pattern << >> /Font << /F6 6 0 R /F7 7 0 R >> /XObject << >> >> endobj 11 0 obj [ ] endobj 8 0 obj << /Length 9 0 R /Filter /FlateDecode >> stream x��[�n�6���+x.��CR� ��l�)�C� �z(z(����͢����%-ڢ�Y���i����%��p�=�gH����_������O�>