1

In a react app, I am getting a raw pdf string from an API and I would like to convert it to a pdf document in a new tab in the user browser.

I fetch the data with a simple Axios request and get something like this in return:

data: "JVBERi0xLjcKNyAwIG9iago8......."
status: 200
statusText: "OK"
headers: {
cache-control: "no-cache, must-revalidate"
content-length: "361614"
content-type: "application/json; charset=utf-8"
expires: "0"}.....

any suggestions on how to convert this raw string to a pdf file in react?

Amir Shahbabaie
  • 1,352
  • 2
  • 14
  • 33
  • `JVBERi0xLjcKNyAwIG9iago8...` is a base64 encoding of `%PDF-1.7 ...` - you'll have to decode the base64 encoding to get at the binary PDF. – AKX Mar 27 '20 at 10:58

0 Answers0