Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

108
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda