react-native-pdf icon indicating copy to clipboard operation
react-native-pdf copied to clipboard

I'm tring to display pdf but PDF shows blank screen, I'm using base64 data in source

Open Rahmathirshad opened this issue 1 year ago • 3 comments

  1. I recieved this response -> {"_data": {"__collector": {}, "blobId": "23ffc5c3-ace3-492b-864f-ae04780955bc", "offset": 0, "size": 3028}}

  2. then I convert response to base64: const reader = new FileReader; reader.onerror = () => console.log("reject"); reader.onload = () => { console.log(reader.result); // data:application/octetstream;base64,JVBERi0xLjMNCiXi48/TDQoNCjE.... setPdfData(reader.result); }; reader.readAsDataURL(response.data);

  3. const source = {uri: pdfData, cache: true};

after all of this I'm getting white blank screen

Rahmathirshad avatar May 16 '24 11:05 Rahmathirshad

You need to replace data:application/octet-stream with data:application/pdf

jaraujo-ob avatar Jun 28 '24 17:06 jaraujo-ob