2

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);

4
  • Does this answer your question? Display PDF in reactJS Commented Nov 8, 2022 at 12:25
  • You could take a look at this question: stackoverflow.com/questions/45596329/display-pdf-in-reactjs Commented Nov 8, 2022 at 12:26
  • No. I am getting errors in packages. Some packages are deprecated Commented Nov 8, 2022 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: stackoverflow.com/questions/4853898/… Of course, having an out-of-the-box-just-add-water component would be better. Commented Nov 9, 2022 at 11:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.