Base64 image string does not work with PDFDownloadLink
See original GitHub issueDescribe the bug PDFDownloadLink does not support having an Image component with base64 string data of the image as it’s source.
To Reproduce Steps to reproduce the behavior including code snippet (if applies):
-
Use the
toBase64Image()
provided in Chart.js library to export a chart as base64 string. The output looks like the following:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABWAAAAK...
-
In the impl of the document associated to
PDFDownloadLink
, I am doing this:<Image src={{data:<base64 string data>, format: 'png'}}></Image>
. -
Don’t see the image added to the pdf and the entire pdf css is broken now.
Expected behavior Expected to see the chart inserted as an Image component in the downloaded pdf.
Desktop (please complete the following information):
- OS: MacOS
- Chrome, Safari
- React-pdf version :
npm list --depth=0 | grep react-pdf ├── @react-pdf/renderer@1.6.12 ├── react-pdf@5.0.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
It worked for me like this:
any solution to this? this is still not fixed. Using base64 image still does not work with PDFDownloadLink.