1

I am creating a pdf and saving it in node js backend. I want to send this PDF to react. Currently I am converting it to an array buffer and sending the buffer to react, how can I view that file in react?


  data = fs.readFileSync(`./userCertificates/${username}.pdf`);
  

  let setSendResponseData = new sendResponseData(data, 200, null);
  let responseToSend = encryptionOfData(setSendResponseData.success()); //I am using encryption on both end
  res.send(responseToSend);

Manas S. Roy
  • 303
  • 1
  • 10
  • Does this answer your question? [Display PDF in reactJS](https://stackoverflow.com/questions/45596329/display-pdf-in-reactjs) – Haroldo_OK Nov 08 '22 at 12:25
  • You could take a look at this question: https://stackoverflow.com/questions/45596329/display-pdf-in-reactjs – Haroldo_OK Nov 08 '22 at 12:26
  • No. I am getting errors in packages. Some packages are deprecated – Manas S. Roy Nov 08 '22 at 12:40
  • If none of the prepackaged options happen to work, an alternative would be to implement your own React component built on top of some generic JS solution: https://stackoverflow.com/questions/4853898/display-pdf-within-web-browser Of course, having an out-of-the-box-just-add-water component would be better. – Haroldo_OK Nov 09 '22 at 11:13

0 Answers0