0

I m trying to develop an application in which I draw a rectangle on PDF using Accusoft pdfXpress rectangle tool, Now I have coordinates of the paragraph I selected. Now what I want to do is text extract from this region with font.

After too many research I've extracted plain text through many libraries like iTextSharp, PDFBOX, Aspose and tried for font extraction but I'm unable to fetch text with font. Please provide some help regarding this.

Using PDFTextstream I got plain text like this:

public string gettextf(float x, float y, float w, float h, string docpath)
{
    PDFTextStream stream = new PDFTextStream(docpath);
    RegionOutputTarget tgt = new RegionOutputTarget();
    tgt.addRegion(x, y, w, h, "name");
    tgt.addRegion(40, 570, 120, 16, "address");

    Page p = stream.getPage(0);
    p.pipe(tgt);
    stream.close();

    String name = tgt.getRegionText("name");
    String address = tgt.getRegionText("address");
    return name;
}
Alexis Pigeon
  • 7,223
  • 11
  • 38
  • 44
choudhary
  • 29
  • 4

0 Answers0