I want to display my PDF stored in my backend (path: '/pdfEdition/{pdfName}.pdf'), using my frontend. I configured a proxy in the package.json file like this:
"proxy": "http://localhost:6545/",
to make the communication between frontend and backend easier (avoiding CORS issues).
I tried 2 ways to display my PDF:
using
<iframe />like this :<iframe src='/pdfEdition/{pdfName}.pdf' />but it was just displaying my app instead of my PDF. Here I want the PDF being displayed inside of the<iframe />instead of my appUsing 'react-pdf': I could open my PDF correctly, but only in my 'public' folder (in the frontend). So I tried to generate directly my PDF in my 'public' folder from my backend. The problem is that for each PDF generation, it was restarting my app (even before starting to display my PDF) whlie using
event.preventDefault();on the function called by the button used to generate PDF. (The PDFs were correctly generated) (I think that's because there is a new file in the react project so it is reloading it.) Here I want to avoid app refreshing when a PDF is generated
Any advice is welcome.