0
PDF in react app
How can I add pdf files in my react app, so others can download it? Without a back-end or anything. Just like putting some pdf files in a folder inside "src" and users will be able to click on download and get the full pdf file downloaded.
3 Risposte
+ 2
Put the pdf in the correct place and set react render with <PdfDownload/> component.
// react component
const PdfDownload = () =>
<a href='/fileabc.pdf' download>Click to download pdf file</a>
+ 1
So I just need jsx and write this simple html code? Never thought about it. Thanks
0
Working with PDFs inside a React app can be surprisingly tricky, especially when you want a simple “click and download” setup without bringing in a backend. I ran into a similar issue a while ago when I had to prep some downloadable guides, and it pushed me into reading a bunch of threads about handling messy PDF exports - including this one: https://www.reddit.com/r/pdf/comments/1lg32in/tried_pdf_gurus_ocr_tool_pretty_solid_so_far_but/. Some of the advice there helped me clean up the files before throwing them into my project.



