If anyone runs into this problem, here is what I did:
PdfTextField txtField = (PdfTextField)field; PdfArray fieldRect = (PdfArray)txtField.Elements.GetValue(PdfAnnotation.Keys.Rect); PdfRectangle rect = txtField.Elements.GetRectangle(PdfAnnotation.Keys.Rect); XRect rectangle = new XRect(rect.X1, rect.Y1, rect.Width, rect.Height); XRect pdfPosition = gfx.Transformer.WorldToDefaultPage(rectangle); XBrush backgroundBrush = new XSolidBrush(XColor.FromArgb(64, XColors.Yellow)); XBrush borderBrush = new XSolidBrush(XColor.FromArgb(128, XColors.Yellow));
gfx.DrawRectangle(backgroundBrush, pdfPosition); gfx.DrawRectangle(borderBrush, pdfPosition);
|