i am trying to generate pdf file by using node
- 
					
					
					
 router.get('/:jsreport', function (req, res, next) { 
 jsreport.render({
 template: {
 content: '<h1>Hello</h1>',
 engine: 'jsrender',
 recipe: 'phantom-pdf'
 },
 options: {
 "preview": true
 },
 data: {
 foo: "world"
 }
 }).then(function(resp) {
 res.json({
 success:true,
 data:resp,
 message:"leases"
 })
 // write report buffer to a file
 // fs.writeFileSync('report.pdf', resp.content)
 });
 });
 resp was converted into my front end code like this :
 $scope.printfn=function(){
 bookingService.get({jsreport:"jsreport"},function (response) {
 var myBlobObject=new Blob([response.data.content.data],{ type:'application/pdf'});
 var name = 'notes.pdf';
 var url = window.URL || window.webkitURL
 var fileURL = url.createObjectURL(myBlobObject);
 var downloadLink = angular.element('<a></a>');
 downloadLink.attr('href',fileURL);
 downloadLink.attr('download',name);
 downloadLink.attr('target','_self');
 downloadLink[0].click();//call click functiona
 url.revokeObjectURL(fileURL);//revoke the object from URL
 })
 }
 and my response is:
 data
 :
 {headers: {Content-Type: "application/pdf", Content-Disposition: "inline; filename="report.pdf"",…},…}
 content
 :
 {type: "Buffer",…}
 data
 :
 [37, 80, 68, 70, 45, 49, 46, 52, 10, 49, 32, 48, 32, 111, 98, 106, 10, 60, 60, 10, 47, 84, 105, 116,…]
 type
 :
 "Buffer"downloaded pdf files shows: 
 