Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using iTextSharp.text.pdf;
- using iTextSharp.text.pdf.parser;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Bio_Pdf_Extractor
- {
- class Program
- {
- public static class PdfExtract
- {
- public static string PdfText(string path, int page)
- {
- PdfReader reader = new PdfReader(path);
- string text = string.Empty;
- text += PdfTextExtractor.GetTextFromPage(reader, page);
- reader.Close();
- return text;
- }
- }
- static void Main(string[] args)
- {
- string bio_file = @"C:\Users\hasan.canim\Desktop\Wilfried\";
- string[] files = Directory.GetFiles(bio_file, "*.pdf", SearchOption.AllDirectories);
- foreach(string file in files) // Each file in the directory
- {
- var pdfString = PdfExtract.PdfText(file, 1);
- Console.WriteLine(pdfString);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement