Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to extract text coordinates from Pdf?
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Question:Hi! Can anyone tell me how to get coordinates in a pdf document using c# or .Net, suppose if some text is written in the pdf document then how do I get coordinates of that text? It's very urgent. Thanks. Answer:This is easily done using the Pdfium.Net SDK. See the example below Code:
public void ExtractTextInfo()
{
//Initialize the SDK library
//You have to call this function before you can call any PDF processing functions.
PdfCommon.Initialize();
//Open and load a PDF document from a file.
using (var doc = PdfDocument.Load(@"c:\test001.pdf"))
{
//Get second page from document
using (var page = doc.Pages[1])
{
//Extract text information structure from the page
// 10 - Index for the start characters
// 25 - Number of characters to be extracted
var textInfo = page.Text.GetTextInfo(10, 25);
//Gets text from textInfo strtucture
string text = textInfo.Text;
//Gets a collection of rectangular areas bounding specified text.
var rects = textInfo.Rects;
}
}
//Release all resources allocated by the SDK library
PdfCommon.Release();
}
|
|
|
|
|
|
Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to extract text coordinates from Pdf?
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close