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

442
Vistas
Encoding a remote URL PDF to BASE64 (javascript)

I am trying to encode a PDF that is remotely on a server (not locally neither selecting files using a javascript/HTML "Browse" button) into BASE64.

I already have checked some examples kindly given by others in StackOverflow such as:

Convert PDF to a Base64-encoded string in Javascript

How to convert file to base64 in JavaScript?

But every time I pass the variable where the remote URL for the PDF is, it shows an error saying:

TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.

function funcTransfPDFParaBase64(strCaminhoPDF) {
var reader = new FileReader();

   reader.readAsDataURL(strCaminhoPDF)
   reader.onload = function () {
     console.log(reader.result);
   };
   reader.onerror = function (error) {
     console.log('Error: ', error);
   };
   
   return reader.result;
}

var objTeste = funcTransfPDFParaBase64(strCaminhoPDF);

URL type used in var strCaminhoPDF: https://somesite/fs/file/Download/FileShare/www/Legislation/2015/DL_2015021028.pdf

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