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

157
Visualizações
Storing ITextSharp Data

So an update, I've gotten my code to be able to read a single pdf file and parse the information into a text file. Great. Now I want to figure out how to do the following two things.

  1. Get the program to be able to read more than 1 pdf file. If I could get it to read an entire file folder, that would be best. I'm not sure how to change the code to do that, but I know it can't be that different.

  2. Change the activation method. If I could get it so that the code ran whenever a new file was dropped into a folder, that would be absolutely amazing. That has to be possible, to somehow have an event listener that activates whenever a file is dropped into a folder and parses the information.

     public static string ExtractTextFromPdf(string path)
     {
         ITextExtractionStrategy its = new iTextSharp.text.pdf.parser.LocationTextExtractionStrategy();
    
         using (PdfReader reader = new PdfReader(path))
         {
             StringBuilder text = new StringBuilder();
    
             for (int page = 1; page <= reader.NumberOfPages; page++)
             {
                 ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
    
                 string currentText = PdfTextExtractor.GetTextFromPage(reader, page, strategy);
    
                 currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText)));
                 text.Append(currentText);
             }
    
             System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\kttricic\OneDrive - Burns & McDonnell\Desktop\test file\POs\test");
             file.WriteLine(text);
    
             file.Close();
    
             return text.ToString();
         }
     }
    
     static void Main(string[] args)
     {
         Console.WriteLine(ExtractTextFromPdf(@"C:\Users\kttricic\OneDrive - Burns & McDonnell\Desktop\test file\POs\PO 4505234816 Siemens Industry, Inc. 6.15.21.pdf"));
     }
    
over 4 years ago · Santiago Trujillo
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