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?
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 PatelEnterprise ArchitectCommented:
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Chinmay PatelEnterprise ArchitectCommented:
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 PatelEnterprise ArchitectCommented:
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 PatelEnterprise ArchitectCommented:
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 ConnectWise

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 PatelEnterprise ArchitectCommented:
Author has not reverted back. The code provided does what author has asked for.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.