pvginkel / PdfiumViewer

PDF viewer based on Google's PDFium.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how can i get words locations (x, y coordinates)?

DenisSouth opened this issue · comments

I can extract text like this. but I want to get locations of each phrase

public static string get_text(string PDFFilePath) {
string feed = "";
using(var document = PdfiumViewer.PdfDocument.Load(PDFFilePath))
{
var dpi = 300;
using(var image = document.Render(0, dpi, dpi, PdfRenderFlags.CorrectFromDpi)) {
feed = feed + document.GetPdfText(0) + "\n";
var encoder = ImageCodecInfo.GetImageEncoders().First(c => c.FormatID == ImageFormat.Jpeg.Guid);
var encParams = new EncoderParameters(1);
encParams.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100 L);
}
}
return feed;
}