Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Apr 14, 2016 5:34 pm

Hi,

I have a PDF with tabular data, and would like to retrieve the text blocks, their locations, and contents. Is this possible with Spire? I perused the API docs but found nothing related to text location.

budai
 
Posts: 1
Joined: Thu Apr 14, 2016 5:16 pm

Fri Apr 15, 2016 2:38 am

Hi,

Thanks for your posting.
Sorry that our Spire.PDF cannot implement your requirement at present.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Sat Jan 09, 2021 1:36 pm

Are there any near future plans to implemet possibility of extracting text together with location information from .pdf?

bbrodnik
 
Posts: 16
Joined: Sat Jan 09, 2021 10:38 am

Mon Jan 11, 2021 8:40 am

Hello,

Thanks for your inquiry and sorry for the late reply as weekend.

I am sorry that our Spire.PDF cannot extract text with location information now. But I would like to suggest you that using the FindAllText() method to find all text with its location, here is my test code.
Code: Select all
            PdfDocument doc = new PdfDocument();
            doc.LoadFromFile("E:\\testdoc\\sample2.pdf");

            List<PdfTextFindCollection> collections = new List<PdfTextFindCollection>();
            Dictionary<PointF, string> textANDposition = new Dictionary<PointF, string>();

            foreach (PdfPageBase page in doc.Pages)
            {
                PdfTextFindCollection collection = page.FindAllText();
                collections.Add(collection);
            }

            foreach(PdfTextFindCollection collection in collections)
            {
                foreach(PdfTextFind find in collection.Finds)
                {
                    PointF point = find.Position;
                    string str = find.MatchText;
                    textANDposition.Add(point, str);
                }
            }


Hope it can match your needs. I am looking forward to your feedback.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Mon Jan 11, 2021 10:51 am

This is what I was looking for. Thak you for quick answer.

Regards,
Brane

bbrodnik
 
Posts: 16
Joined: Sat Jan 09, 2021 10:38 am

Tue Jan 12, 2021 1:20 am

Hello,

Thanks for your feedback!

Glad to hear that the code is match your needs.

If you encounter any issues related to our product in the future, just feel free to contact us.

Have a nice day!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF