Click here to Skip to main content
15,500,453 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to extract all email and respective client id from a pdf file to any control in

how can I get this?

What I have tried:

I have tried

string urlFileName1 = "C:/Users/rtech/Desktop/Create-PDF-Images/PDF-Files/123.pdf";
       PdfReader reader = new PdfReader(urlFileName1);
       string text = string.Empty;
       for (int page = 1; page <= reader.NumberOfPages; page++)
           text += PdfTextExtractor.GetTextFromPage(reader, page);
       lblText.Text = text.ToString();

but it is extracting all pdf data. I want only emails and client ID
please help me out..
Updated 14-Feb-21 21:14pm

1 solution

First of all, you have to:
1. extract text of pdf to List<string>
2. use Regex to find emails and ids.

Here is an idea how to extract emails from list of string. See: C# code to extract Email from text · GitHub[^]

We have no idea how your pdf looks like. So, we can't help you more.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900