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

107
Views
Preserving indentation with Tesseract.js library

I am using tessearct.js library in my angular code. I want to preserve the white spaces, the indentation as it is. How to do it? Currently I am using this piece of code to do it.

async doOCR {
    const worker = createWorker({
      logger: m => console.log(m),
    });
    
    await worker.load();
    await worker.loadLanguage('eng');
    await worker.initialize('eng');
    const value = await worker.recognize(this.selectedFile);
  }

I am looking a method to do it on client side only, that's why not using its python library.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can give it a try after version (3.04), they have added the preserve_interword_spaces`. You can try this and check if this works:


async doOCR {
    const worker = createWorker({
      logger: m => console.log(m),
    });
    
    await worker.load();
    await worker.loadLanguage('eng');
    await worker.initialize('eng');
  // there is no proper documentation, but they have added this flag
  // to run it as a command
    await worker.setParameters({
       preserve_interword_spaces: 1,
    });

    const value = await worker.recognize(this.selectedFile);
  }
 
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!