static void DrawGraphics(PdfGraphics graph, PdfTextSearchResults result, SolidBrush brush) { for (int i = 0; i < result.Rectangles.Count; i++) { RectangleF rect = new RectangleF(new PointF((float)result.Rectangles[i].Left, (float)result.Page.CropBox.Top - (float)result.Rectangles[i].Top), new SizeF((float)result.Rectangles[i].Width, (float)result.Rectangles[i].Height)); graph.FillRectangle(brush, rect); } graph.AddToPageForeground(result.Page, 72, 72); }