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

219
Vistas
Get text including line breaks from uploaded pdf

I am currently working on a small website, on which it should be possible to upload a .pdf file. For the websites functionality, I need to read the text from the pdf into a variable, including the line breaks. So for example if the text in the pdf is:

Hello World
How are you today?

Then the text in the variable should be "Hello World\nHow are you today?".

I have tried several things, but none of these worked for me.

HTML:

<input type="file" id="file" accept=".pdf">

I have tried the following code in my app.js:

function readPdf(){
    const file = document.getElementById('file').files[0];
    const reader = new FileReader();
    var output = "";
    reader.addEventListener("load", function () {
        output += reader.result;
    }, false);

    if (file) {
        reader.readAsBinaryString(file);
    }
    return output;
}

But this is only giving me a hieroglyphic string.

Has anyone ever tried something like this and could tell me the way how it is done?

Thanks in advance

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