Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!