Allow PDF download

Hello,

I am experiencing issues while attempting to allow users to download my PDF file on the About page. I have tried various methods including file-loaders, node-loaders, and pdf-loaders but keep encountering errors such as “empty file”, “file not found”, or “The file “myfile .pdf” could not be opened.”

Some common errors on the server include:

  • http://localhost:3004/static/documents/walter.pdf 404 (Not Found)”
  • “ERROR in ./node_modules/canvas/build/Release/canvas.node 1:0 Module parse failed: Unexpected character ‘�’ (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See Concepts | webpack (Source code omitted for this binary file)”
  • “Error: ./static/documents/walter.pdf 1:0 Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See Concepts | webpack

I have also tried using libraries such as react-pdf and file-saver, as well as various other methods like javascript blobs, window.open, and anchor tags. I have even attempted to import the PDF from the public or static folders.

In the About page’s , I have tried five different methods, but none of them have worked.

My Github branch can be found here: GitHub - walter-clayton/walter-clayton-new at walt-16

I have been struggling with this issue for several days and would greatly appreciate any help or suggestions.

Thank you.

1 Like