Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

140
Vistas
JS How to get PDF from URL and save to a variable

I have a link. If it is executed in a browser it triggers PDF-file downloading. I want to get this file in JS from this link and store it to a variable. Is it possible?

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Yes, you can do it. For example, you can store the pdf into the blob (file-like object). https://developer.mozilla.org/en-US/docs/Web/API/Blob

const url = 'your link to the PDF'

let pdf;

fetch(url)
  .then(response => response.blob())
  .then(blob => {
    pdf = blob
  })
7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos