Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

454
Views
Problem dowloading a pdf file through browser using javascript

I have to present for an exam a portfolio which allows visitors to download some documentations about my projects as pdf files.

I tried using an tag with a "download" attribute, unfortunately when I try to download the file by clicking on the link, the file is proposed to be recorded as .html or all files.

Whatever option I choose, after downloading the file, I'm not able to open it because it seems damaged or in the wrong format.

enter image description here

Here's the code I use :

enter image description here

My "demo" var is contained in an object Work as you can see on the screenshot :

enter image description here

In case it matters, my pdf file is stored here:

enter image description here

Thanks for you help ! =)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As a wild guess :

  • your path is wrong (documents/pdt-test.pdf)
  • your html is missing a doctype or a proper structure
  • you need a doctype/pdf somewhere. Something like in here Download a by ByteArray as pdf /handle error in React
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!