npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

dta-vision-ocr

v20.0.0

Published

Biblioteca Angular com PO UI para extração de dados estruturados via OCR a partir de imagens ou PDFs, retornando JSON configurável com suporte a processamento em lote.

Downloads

241

Readme

# DTA VISION OCR

Biblioteca para facilitar a extração de texto de qualquer imagem, parametrizada pelo formulário para extrair um JSON.

## Como instalar

```bash
npm install dta-vision-ocr

ou

yarn add dta-vision-ocr

Como usar

É necessário possuir um código de projeto para uso. Após obtenção do código do projeto, basta seguir os passos abaixo.

Uso no HTML

<po-button p-label="Abrir DTA Vision QrCode" (p-click)="abrirDtaVision()" p-icon="ph ph-qr-code"></po-button>

  @if(this.habilitarModalOcr) {
    <dta-vision-ocr #webAppModal
      [idDTAVision]="idTotvsVision"
      [idProjeto]="idProjeto"
      [user]="user"
      [contingency]="contingency"
      [listButtonsDocument]="buttonList"
      (informacaoEnviada)="receberInformacao({ menssagem
        : $event.menssagem, uniqueKey: $event.uniqueKey})">
    </dta-vision-ocr>
  }

Para TypeScript

  standalone: true,
  imports: [
    DTAVisionOCRComponent //se standalone for false importe no seu module.
  ],
idDta = "";
idProjeto = "";
habilitarModalOcr = false;
user = "";
contingency = "";

@ViewChild('webAppModal') webAppModal?: DTAVisionOCRComponent;


abrirDtaVision() {
  this.habilitarModalOcr = true;
  this.webAppModal?.openWebAppModal();
}

// Exemplo de buttonList
   buttonList : ButtonDocumentModel[] = [
    {
      "idButton": "01",
      "nameButton": "Dados Pessoais",
      "imageReturn": true,
      "userFields": [
        {
          "fieldName": "name",
          "fieldDescription": "Nome do usuario",
          "fieldType": "string"
        },
        {
          "fieldName": "cpf",
          "fieldDescription": "Cpf do usuario",
          "fieldType": "string"
        },
        {
          "fieldName": "validade",
          "fieldDescription": "Data de validade da carteira",
          "fieldType": "string"
        },
        {
          "fieldName": "dataNascimento",
          "fieldType": "string"
        }
      ]
    },
    {
      "idButton": "02",
      "nameButton": "Historico Escolar",
      "imageReturn": false,
      "userFields": [
        {
          "fieldName": "alunoInfo",
          "fieldType": "object",
          "subFields": [
            {
              "fieldName": "nomeAluno",
              "fieldDescription": "Nome do aluno",
              "fieldType": "string"
            },
            {
              "fieldName": "matricula",
              "fieldDescription": "Matricula do aluno",
              "fieldType": "string"
            }
          ]
        },
        {
          "fieldName": "disciplinas",
          "fieldType": "array",
           "subFields": [
            {
              "fieldName": "disciplina",
              "fieldDescription": "Nome da discipline",
              "fieldType": "string"
            },
            {
              "fieldName": "nota",
              "fieldDescription": "Nota do aluno",
              "fieldType": "string"
            },
            {
              "fieldName": "cargaHoraria",
              "fieldDescription": "Carga horario do aluno",
              "fieldType": "string"
            },
            {
              "fieldName": "credito",
              "fieldDescription": "Credito do aluno",
              "fieldType": "string"
            }
          ]
        }
      ]
    }
  ]

Para facilitar a criação do Json acima

https://html-teste-pi.vercel.app/
receberInformacao(informacao: { menssagem: DocumentResponse; uniqueKey: number; }) {
  let parsedResponse;
  try {
    parsedResponse = JSON.parse(informacao.menssagem.ocrResponse);
  } catch (error) {
    console.error(`Erro ao desserializar ${informacao.menssagem.idButton}:`, error);
    return;
  }

  switch (informacao.menssagem.idButton) {
    case "1":
      const dadosPessoais = parsedResponse as DadosPessoais;
      // Preencher os dados pessoais no formulário
      break;
    case "2":
      const historicoEscolar = parsedResponse as HistoricoEscolar;
      // Preencher o histórico escolar no formulário
      break;
    default:
      console.warn(`Não existe o ID do botão: ${informacao.menssagem.idButton}`);
      break;
  }
}

Explicação do buttonList

  • idButton: Identificador único para o botão. Através dele vai ser usado para recupera o botão com switch
  • nameButton: Nome exibido no botão.
  • imageReturn: Define se a imagem deve ser retornada.
  • userFields: Lista de campos que serão extraídos pela OCR.
    • fieldName: Nome do campo.
    • fieldDescription: Descrição do campo (Seja detalhista)
    • fieldType: Tipo de dado esperado.

Dados experados no exemplo


export interface DadosPessoais {
    name: string;
    cpf: string;
}

export interface HistoricoEscolar {
  alunoInfo: AlunoInfo;
  disciplinas: Disciplina[];
}

export interface AlunoInfo {
  nomeAluno: string;
  curso: string;
}

export interface Disciplina {
  disciplina: string;
  nota: string;
  cargaHoraria: string;
  credito: string;
}

Uso do projeto no stackblitz

https://stackblitz.com/~/github.com/yuriduartetotvs/dtaVisionStackBlitz