0
using (FileStream fs = new FileStream(@"F:\test\resulthighlight.pdf", FileMode.Create, FileAccess.Write, FileShare.None))
{
    using (PdfStamper stamper = new PdfStamper(reader, fs))
    {
        iTextSharp.text.Rectangle rect = new iTextSharp.text.Rectangle(60.6755f, 749.172f, 94.0195f, 735.3f);
        float[] quad = { rect.Left, rect.Bottom, rect.Right, rect.Bottom, rect.Left, rect.Top, rect.Right, rect.Top };


        PdfAnnotation highlight = PdfAnnotation.CreateMarkup(stamper.Writer, rect, null, PdfAnnotation.MARKUP_HIGHLIGHT, quad);
        //Set the color
        highlight.Color = BaseColor.YELLOW;

        //Add the annotation

        stamper.AddAnnotation(highlight, 1);
    }
}

I tried this but I am failing to find coordinate of my search text any one help me? I used ITextExtractionStrategy and LocationTextExtractionStrategy of the Itextsharp parser.

Matthew Walton
  • 9,809
  • 3
  • 27
  • 36
  • You have the same problem as http://stackoverflow.com/questions/21850782/how-to-read-and-markhighlight-a-pdf-file-using-c-sharp Please read my comment: nobody is able to help you if you don't provide a PDF. When we see the PDF, we might answer: "you're asking something that is impossible" or "You can get full words like this: http://stackoverflow.com/questions/21821289/words-are-stemming-while-parsing-using-itext-library-in-java " – Bruno Lowagie Feb 18 '14 at 13:52
  • @user3323457 *I used `ITextExtractionStrategy` and `LocationTextExtractionStrategy` of the Itextsharp parser.* - did you find all occurrences of your search *text* in there? In that case it should be possible to slightly extend the strategy to also report coordinates. If you did not find all of them, things get tough. – mkl Feb 18 '14 at 14:31

0 Answers0