Can't understand why it doesn't display the Blob file. the code is:
openBlob = fileBuffer => {
const file = new Blob([fileBuffer], { type: "image/bmp" }); // You could also add the MIME type here as { type: "application/pdf" }
const fileURL = URL.createObjectURL(file);
console.log("fileURL" + fileURL)
window.open(fileURL, "_blank_");
};
render() {
const archivioItems = this.state.archivio.map((archivio, i) => {
return (
<tr key={archivio.hash_referto}>
<td>{archivio.tipo_esame}</td>
<td>{archivio.data_esame}</td>
<td>
<Tab icon={<AssignmentIcon />}
className="tab"
onClick={() => this.openBlob(archivio.uri)}></Tab>
</td>
</tr>
)
})
It opens a new page as a pdf, but then returns an alert with "It's not possible to open the pdf document" (even it's a pdf document). And more, is there a way to open any kind of document?