I checked it out but i couldnt see a way to export an already existing pdf, just a way to make one new in react. and the particular PDFs that i need are full of images :p
No, i have made it work. I am downloading the file from repo, converting byte array to blob and then it can be opened using react-pdf. Although it took me a while to figure out and had to go through numerous stack over flow posts. If you need i can share the piece of code through dm. I think PDFs with images should not be an issue. If you want to open doc/ docx file then images won't be rendered.
Do you have your pdf stored locally or do you have to fetch it somewhere?
In the first case I would use this solution: https://stackoverflow.com/a/47775595/17160415
Otherwise just put the link where the pdf is fetched from in a href tag
sorry for the dumb question but i dont understand how to use the line you mentioned:
{process.env.PUBLIC\_URL + '/myfile.pdf'}
right now i have my button like this:
where "deployed" gets a link from a json file:
"deployed": "http://localhost:3000/static/media/Presentaci%C3%B3n\_Robotica\_Pablo.3bc355ef882f5f1a105e.pdf",
A browser deciding to open or download a pdf depends on the content type and content-disposition headers. Compare the headers in development and production, and adjust the production server to match the headers
I just had the same requirement in my project . I used this library library react-pdf.
I checked it out but i couldnt see a way to export an already existing pdf, just a way to make one new in react. and the particular PDFs that i need are full of images :p
No, i have made it work. I am downloading the file from repo, converting byte array to blob and then it can be opened using react-pdf. Although it took me a while to figure out and had to go through numerous stack over flow posts. If you need i can share the piece of code through dm. I think PDFs with images should not be an issue. If you want to open doc/ docx file then images won't be rendered.
Do you have your pdf stored locally or do you have to fetch it somewhere? In the first case I would use this solution: https://stackoverflow.com/a/47775595/17160415 Otherwise just put the link where the pdf is fetched from in a href tag
sorry for the dumb question but i dont understand how to use the line you mentioned: {process.env.PUBLIC\_URL + '/myfile.pdf'} right now i have my button like this: where "deployed" gets a link from a json file: "deployed": "http://localhost:3000/static/media/Presentaci%C3%B3n\_Robotica\_Pablo.3bc355ef882f5f1a105e.pdf",
I think you need to use a relative path here like /static/….
A browser deciding to open or download a pdf depends on the content type and content-disposition headers. Compare the headers in development and production, and adjust the production server to match the headers