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

Image component can't render JPG image

Open AngelDev0329 opened this issue 6 months ago • 4 comments

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?

AngelDev0329 avatar Feb 07 '24 13:02 AngelDev0329

are you getting this error? JPG is not a constructor

krzysztof-stanislawski avatar Feb 07 '24 14:02 krzysztof-stanislawski

We will need more details about error

diegomura avatar Feb 07 '24 15:02 diegomura

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" />

arvind-14 avatar Feb 07 '24 19:02 arvind-14

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

Elvinra avatar Feb 13 '24 14:02 Elvinra

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

renchap avatar Mar 02 '24 17:03 renchap