0

i have a base64 pdf response from api something as:

const res = 'JVBERi0xLjQKJeLjz9MKNCAwIG9iago8PC9GaWx0ZXIvRmxhdGVEZWNvZGUvTGVuZ3RoIDQ1MD4+c3RyZWFtCnicrVTNctowEL7' 

I am trying to convert it to image src as follows:

<img src={`data:application/pdf;base64,${res}`} alt='not found'/>

But getting alt text only and the response is also correct.But when i am using it in

<embed src={`data:application/pdf;base64,${res}`} type="application/pdf" />

it works fine with embed. How can i change the base64 string to url which supports.And how can i print it after preview.

ashika
  • 47
  • 6

0 Answers0