Maybe I’m missing something, but PDFs are not images so I don’t see how converting it base64 and trying to display it as an image would work?
If you wanted to do that I’d image these are the steps
- Convert the PDF to a PIL object: https://github.com/Belval/pdf2image
- Export the PIL object to a PNG: https://stackoverflow.com/a/19651233/2958068
- Display in base64 like this: PNG image not showing
However this may not look good and you won’t get PDF features like text selection and copying. The only way I know to display a real PDF on a web-page without relying on external technologies like Adobe Acrobat is to use pdf.js.
It should be possible to take a React version of pdf.js and create a Dash component out of it:
- https://www.npmjs.com/package/react-pdf-js
- https://dash.plot.ly/react-for-python-developers
- https://dash.plot.ly/plugins
But I don’t think it’s a small undertaking.