I'm trying to render a embed pdf file using PDFObject. In the backend I send the pdf as follows
fs.readFile(uploadFileFd, function (err,data){
res.contentType("application/pdf");
res.send(data);
});
After that I'm get the response in the front as follows
$.get("/loadDocument",function(data){
PDFObject.embed(data,"#test");
});
And I'm getting the following result image with the render in the browser of the pdf
Do you know how to fix that?
I found that the problem was the encoding of the pdf file, so I encoded the file as base64 in the backend using 'base64-stream':
After that I use a embed tag to show the pdf: