PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 25 → Aula 1005 - Relatorio - 40 - Pdf - Ler e Extrair Texto
Aula 1005 - Relatorio - 40 - Pdf - Ler e Extrair Texto
Iniciado por amarildo, dez., 21 2016 11:19 AM - Sem resposta
Membro registado
535 mensagems
Popularité : +14 (14 votes)
Publicado em dezembro, 21 2016 - 11:19 AM
// Le o Pdf, Extrai Texto , e Adiciona Chave No Conhecimento em Tabela

arquivo_pdf is string = "" // fSelect("", "", "Seleciona Um Arquivo Pdf ... ", "Pdf" + TAB + "*.pdf", "*.pdf")
_imagen_string is string = fImageSelect(arquivo_pdf,"","Selecione PDF...","PDF"+TAB+"*.PDF")
_chaves_array is array of string
n_procura is int=0
IF _imagen_string<>"" THEN
IMG_pdf = _imagen_string
nPaginas is int=0
LOOP
nPaginas++
sPagina_atual is string=nPaginas
EDT_pdf_texto = PDFToText(_imagen_string,sPagina_atual) // extrai texto pg 1
IF EDT_pdf_texto="" THEN BREAK
nSoma is int=0
LOOP
nSoma++
Message("Pesquisando Pagina do Pdf Numero:"+nPaginas+" "+CR+EDT_pdf_texto_1[[1 TO 44]]+CR+nSoma)
EDT_pdf_texto_1 = ExtractString(EDT_pdf_texto,nSoma," ")
IF EDT_pdf_texto_1[[1 TO 2]]=estado.codigo_uf_ibge THEN
// IF EDT_pdf_texto_1[[7 TO 20]]=empresa.cnpj THEN
_chave_ is string=EDT_pdf_texto_1[[1 TO 44]]
IF _chave_<>"" THEN
n_procura=Seek(_chaves_array,asLinearFirst,_chave_)
IF n_procura=-1 THEN
TableAddLine(TABLE_conhecimento_nfe)
n_quantos is int=TABLE_conhecimento_nfe..Occurrence
TABLE_conhecimento_nfe[n_quantos]=_chave_
END
END
END
IF EDT_pdf_texto_1=EOT THEN BREAK
END
END
END
TableDisplay(TABLE_conhecimento_nfe)
Message()
Info("Fim da Importação do Relatorio com Chaves")


http://windevdesenvolvimento.blogspot.com.br/2016/12/aula-1005-relatorio-40-pdf-ler-e.html