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

162
Vistas
How can I store the value from recognized text in this Tesseract.recognize in javascript

I want to store the value of the finallext in a variable and print it in a text box how can I do it? Can anybody help me with this????

Tesseract.recognize(
    '../uploads/scanned-images/<?php echo $image_name; ?>',
    'eng',
        { logger: m => console.log(m) }
        ).then(({ data: { text } }) => {
            var extractedText = text;
            var finalText = extractedText.replace(/[^0-9A-Za-z]/gi, '');
            alert(finalText);
    })
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can return some variables in then() like this.

const finalText = await Tesseract.recognize(
    '../uploads/scanned-images/<?php echo $image_name; ?>',
    'eng',
        { logger: m => console.log(m) }
        ).then(({ data: { text } }) => {
            let extractedText = text;
            let finalText = extractedText.replace(/[^0-9A-Za-z]/gi, '');
            // alert(finalText);
            return finalText;
    });
alert(finalText);

P.S You need to use async function.

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