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

636
Vistas
Download PDF File inside an Iframe is not working in Chrome

I have a post web method that generate a pdf file and returns it to the client. I call to this method using a form submit in a new tab using target="_blank", so the pdf opens in the new tab using the PDF Viewer tools of Chrome. Everything is working correct with this implementation, and I can download the pdf file: introducir la descripción de la imagen aquí

But now i want to open it inside an iframe instead of a new tab. I have this in HTML:

<form id="form2" method="post" target="my_iframe" action="">
    <input type="hidden" name="wsInputs" id="wsInputs" />
</form>

<iframe style="width: 100%; height:600px" name="my_iframe" src=""></iframe>

When a button is clicked, i do this in typescript:

 const form = document.getElementById("form2") as HTMLFormElement;
 const input = document.getElementById("wsInputs") as HTMLInputElement;
 input.value = JSON.stringify(wsPDFInputs);
 form.action = endpoint + "api/v1/downloads/get-pdf";
 form.submit();

This works correct, and inside the iframe the document is opened and it works: PDF opened inside the iframe

But, when i click on download button, it does not work. This is what it happens when the file explorer is opened:

File explorer

I do not know why is this happening. In Firefox for example it is working, but not in Chrome. Also, if I click the print icon and I select "save as pdf" works too.

Any ideas? Thanks in advance.

EDIT This is the result of the request that generates the pdf: result 1

enter image description here

Maybe the problem is the response, looks like an html document instead of the pdf file, i do not know why. But the response is the same when target _blank is set.

about 4 years ago · Juan Pablo Isaza
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