- Code: Select all
foreach (PdfTextFind find in docPage.Finds)
{
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font(find.FontName, 8f, FontStyle.Bold));
PdfStringFormat stringFormat = new PdfStringFormat() { WordWrap = PdfWordWrapType.None, NoClip = true, };
PdfBrush brush = new PdfSolidBrush(Color.Black);
RectangleF rect = new RectangleF(find.Position.X,find.Position.Y,find.TextBounds.Max().Width,find.TextBounds.Max().Height+2);
if (placeholder.TextFontColor != null)
font = new PdfTrueTypeFont(placeholder.TextFont);
if(placeholder.TextFontColor != null)
brush = new PdfSolidBrush(placeholder.TextFontColor);
if (placeholder.WordWrapEnabled)
stringFormat = new PdfStringFormat() { WordWrap = PdfWordWrapType.Word, NoClip = true, };
find.SearchPage.Canvas.DrawRectangle(PdfBrushes.White, rect);
find.SearchPage.Canvas.DrawString(item.Value, font, brush, rect.X,rect.Y, stringFormat, true);
}
[img] [img]
How to resolve the text overlapping the line near to it? In the above image I have marked with red line