How to find x,y location of a text in pdf

raki picture raki · Jan 19, 2011 · Viewed 10.1k times · Source

Is there any tool to find the X-Y location on a text content in a pdf file ?

Answer

Vitaliy Shibaev picture Vitaliy Shibaev · Jan 20, 2011

Docotic.Pdf Library can do it. See C# sample below:

using (PdfDocument doc = new PdfDocument("your_pdf.pdf"))
{
    foreach (PdfTextData textData in doc.Pages[0].Canvas.GetTextData())
        Console.WriteLine(textData.Position + " " + textData.Text);
}