Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

444
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda