react-pdf
react-pdf copied to clipboard
Image component can't render JPG image
I want to put jpg image on Image component but it doesn't show it. <Image src="https://d3amu2bzl0th70.cloudfront.net/tickets/test/leaves-nature-macro-plants-wallpaper_1698738909625.jpg" style={{ height: 100, width: 300 }} />
This is my code. How can I fix this?
are you getting this error?
JPG is not a constructor
We will need more details about error
solution 1:Ensure that the image URL you provided is correct and accessible. You can open the URL in a web browser to confirm that the image is loading.
solution 2: You can use simple tag in JSX
<img
src="https://d3amu2bzl0th70.cloudfront.net/tickets/test/leaves-nature-macro-plants-wallpaper_1698738909625.jpg"
style={{ height: 100, width: 300 }}
alt="Nature"
/>
Hello,
I have the same problem.
I'm currently building a PDF with Node 18 (Typescript)
But after some testing, the JPEG is here in the PDF because if i'm trying to open it on Microsoft Edge, it is displayed correctly, but they are no JPEG with Okular (KDE)
With the same file as PNG, they are no problem.
EDIT:
On IPhone they are no JPEG
The error is a regression from https://github.com/diegomura/react-pdf/pull/2591, it no longer defined this.bits
.
I am not sure how to get this information from jay-peg
, but it should be an easy fix for @diegomura