Itextsharp c#

I am 10 pages pdf that each page contain a text called esign
How can I use itextsharp to find the esign position?

Thanks
LVL 1
ITsolutionWizardAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ITsolutionWizardAuthor Commented:
Help?
0
Chinmay PatelChief Technical NinjaCommented:
using (PdfReader reader = new PdfReader(pdfFile.FullName))
                        {
                            using (PdfDocument document = new PdfDocument(reader))
                            {
                                for (int i = 0; i < document.GetNumberOfPages(); i++)
                                {
                                    ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
                                    PdfPage page = document.GetPage(i + 1);

                                    string pageContent = PdfTextExtractor.GetTextFromPage(page);

}
}
}
}

Open in new window


then process pageContent.

Regads,
Chinmay.
0
ITsolutionWizardAuthor Commented:
Should return list of x n y
0
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Chinmay PatelChief Technical NinjaCommented:
What?
0
ITsolutionWizardAuthor Commented:
It should return x and y in pair and if the pdf has 10 signature position, it should return in list
0
Chinmay PatelChief Technical NinjaCommented:
That is something you will have to derive by processing pageContent string variable. Also PDF is handled in a very different way (if you analyze the value of pageContent you will realize that) so be prepared for surprises.
1
ITsolutionWizardAuthor Commented:
Please show me in codes
0
Chinmay PatelChief Technical NinjaCommented:
In general, you will  write something like this

using (PdfReader reader = new PdfReader(pdfFile.FullName))
                        {
                            using (PdfDocument document = new PdfDocument(reader))
                            {
                                for (int i = 0; i < document.GetNumberOfPages(); i++)
                                {
                                    ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
                                    PdfPage page = document.GetPage(i + 1);

                                    string pageContent = PdfTextExtractor.GetTextFromPage(page);
int location = pageContent.indexOf("STRING YOU ARE LOOKING FOR");
}
}
}
}

Open in new window


As PDFs are not like HTML or plain text files you will have to verify and tweak the code as per your PDF's structure.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chinmay PatelChief Technical NinjaCommented:
Author has not reverted back. The code provided does what author has asked for.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.