Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda