Home > database >  How to find xy position of text in pdf or image
How to find xy position of text in pdf or image

Time:10-25

I want to have my code find the xy position of text in a pdf or image, so that I can crop the image out, this is so that I can include any diagrams that the question includes in the question (which consists of an image that text is put on top of), I am currently using the EJ2.PdfViewer from syncfusion but I am happy to use other packages that are more useful for my purposes.

My test code for reference if it will help:

Imports System
Imports Syncfusion.EJ2.PdfViewer
Module Program
    Sub Main(args As String())
        Dim extraction As PdfRenderer = New PdfRenderer()
        extraction.Load("C:\math.pdf")
        Dim textCollection As List(Of TextData) = New List(Of TextData)
        Dim text As String = extraction.ExtractText(44, textCollection)
        Console.WriteLine(text)
    End Sub
End Module

CodePudding user response:

To get position of text in a pdf , you can use some libs:

To get position of text in a Image:

  • Related