ImageGear for .NET does not support modification of forms in PDF documents containing XFA. Please see
XFA Support for more information.
The Acrofroms API supports changing visual properties of fields, such as color, border, and text information. These are properties of the Field and WidgetAnnotation.
Widget Border and Fill Properties
The visual appearance of a widget annotation can be changed through the BorderStyle, BorderColor, BorderWidth and FillColor properties of a widget annotation.
- FillColor and BorderColor can be set to a standard System.Drawing.Color object. Colors stored internally as grayscale or CMYK will be implicitly converted to RGB when accessing these properties.
- BorderWidth can be set to any non-negative integer, or a preset property value provided by AnnotationBorderWidth.
- BorderStyle is set to an entry in the AnnotationBorderStyle enumeration. The styles listed are equivalent to those provided by PDF.
A BorderWidth of 0 will result in no border being drawn. A BorderStyle of SOLID will be returned as the default for fields with no border. A border of INSET is initially applied to RadioGroup fields created by ImageGear.
Example border styles:
C# Example |
Copy Code |
void ModifyWidgetProperties(Field field)
{
foreach(WidgetAnnotation widget in field.Widgets)
{
// Set some fill and border colors.
widget.FillColor = Color.Red;
widget.BorderColor = Color.YellowGreen;
// Set a thick border width (size 3).
// Any integer can also be used.
widget.BorderWidth = AnnotationBorderWidth.THICK;
// Set a border style.
widget.BorderStyle = AnnotationBorderStyle.DASHED;
}
} |
Field Text Properties and Fonts
Most fields containing text have the ability to modify the FontName, FontSize, and TextColor of the displayed textual value.
- FontName refers to the PostScript name of a font currently on the system or embedded in the PDF, such as “Arial” or "Helvetica-Bold".
- FontSize is a size in points specifying the size of the text.
- TextColor can be set to any standard System.Drawing.Color object. Colors stored internally as grayscale or CMYK will be implicitly converted to RGB when accessing this property.
Example FontName, FontSize, and TextColor applications to TextField:
C# Example |
Copy Code |
void ModifyTextProperties(TextField field)
{
// Set some font settings.
field.FontName = "Helvetica";
field.FontSize = 22;
// Color the text.
field.TextColor = Color.BlanchedAlmond;
} |