-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
image is not rendering in image removed when pdf downloaded #55
Comments
The title is confusing and there is no information but I am having this same problem. I am including an image in an Are we able to include images in our PDFs? |
I'm having the same problem |
I am also facing same issue. |
Same issue |
hello, @SinaSaintZero @Tushar-Yadav-TCPL @crscaballero @oliverterrell @itsshajad I am currently experiencing this and wanted to know if any of you were able to find a solution? 🙂 |
@Amaka202 Unfortunately I was not. Due to time constraints I had to pivot to another library instead of taking a ton of time to figure this issue out. I used |
This is how I fixed it. If your image is from a remote URL it will not show. First allow CORS (if working with different hosted backend and frontend). Then covert your remote url to local url at frontend side. This issue occurs as remote URL takes time to process and pdf is generated before the image is fetched. So you have to make sure the image is loaded before converting to pdf.
|
Not sure if that matters now due to the time elapsed, sorry, but on V1 maybe using the import generatePDF, { Options } from 'react-to-pdf'
const options: Options = {
filename: 'test.pdf',
overrides: {
canvas: {
imageTimeout: 10000
}
}
}
const Component = () => {
const targetRef = useRef();
return (
<div>
<button onClick={() => generatePDF(targetRef, options)}>Download PDF</button>
<div ref={targetRef}>
Content to be included in the PDF
</div>
</div>
)
} |
Closing this, but feel free to open another ticket if the problem persists with the newest releases. |
No description provided.
The text was updated successfully, but these errors were encountered: