GetFormFieldBorderStyle(Int32,Single,PdfAnnotationBorderStyle,Single,Single) Method
In This Topic
Returns the style of the line used to draw the border of a required form field, that is specified by its unique form field's identifier and it is related to the currently loaded PDF document.
The border's line dimensions are expressed in the current units defined in the PDF document. You can use the GetMeasurementUnit method to determine the currently defined units and you can use the SetMeasurementUnit method to reset the units according to your preference.
Be aware that if the border's line style differs for each single child radio button in a group of radio buttons within a radio button field, this method will fail. Please use the GetFormFieldBorderStyle(Int32,Int32,Single,PdfAnnotationBorderStyle,Single,Single) method to determine the individual border's line style for each child radio button in a group instead.
Syntax
'Declaration
Public Overloads Function GetFormFieldBorderStyle( _
ByVal As Integer, _
ByRef As Single, _
ByRef As PdfAnnotationBorderStyle, _
ByRef As Single, _
ByRef As Single _
) As GdPictureStatus
public GdPictureStatus GetFormFieldBorderStyle(
int ,
ref float ,
ref PdfAnnotationBorderStyle ,
ref float ,
ref float
)
public function GetFormFieldBorderStyle(
: Integer;
var : Single;
var : PdfAnnotationBorderStyle;
var : Single;
var : Single
): GdPictureStatus;
public function GetFormFieldBorderStyle(
: int,
: float,
: PdfAnnotationBorderStyle,
: float,
: float
) : GdPictureStatus;
public: GdPictureStatus GetFormFieldBorderStyle(
int ,
ref float ,
ref PdfAnnotationBorderStyle ,
ref float ,
ref float
)
public:
GdPictureStatus GetFormFieldBorderStyle(
int ,
float% ,
PdfAnnotationBorderStyle% ,
float% ,
float%
)
Parameters
- FieldId
- A unique form field identifier specifying a required form field object. You can obtain this identifier using methods like GetFormFieldId, GetFormFieldChildID or methods intended to add form fields.
- BorderWidth
- Output parameter. The width of the line used to draw the form field's border, expressed in the current units specified by the SetMeasurementUnit method.
- BorderStyle
- Output parameter. A member of the PdfAnnotationBorderStyle enumeration. The style of the line used to draw the form field's border.
- DashOn
- Output parameter. If the style of the border's line (the BorderStyle parameter) is dashed, this value defines the width of the dashes in the dash pattern used
to draw the border's line. Otherwise, this parameter is ignored. The value is expressed in the current units specified by the SetMeasurementUnit method.
- DashOff
- Output parameter. If the style of the border's line (the BorderStyle parameter) is dashed, this value defines the width of the gaps in the dash pattern used to
draw the border's line. Otherwise, this parameter is ignored. The value is expressed in the current units specified by the SetMeasurementUnit method.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
Example
How to determine border's properties for each form field in the current document.
Dim caption As String = "Example: GetFormFieldBorderStyle"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If gdpicturePDF.LoadFromFile("forms.pdf", False) = GdPictureStatus.OK Then
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
Dim count As Integer = gdpicturePDF.GetFormFieldsCount()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
Dim status As GdPictureStatus = GdPictureStatus.OK
Dim message As String = ""
Dim formID As Integer = 0
Dim type As PdfFormFieldType = PdfFormFieldType.PdfFormFieldTypeUnknown
Dim style As PdfAnnotationBorderStyle = PdfAnnotationBorderStyle.PdfAnnotationBorderStyleSolid
Dim width As Single = 0, dOn As Single = 0, dOff As Single = 0
For i As Integer = 0 To count - 1
formID = gdpicturePDF.GetFormFieldId(i)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
message = message + (i + 1).ToString() + ".field's type: "
type = gdpicturePDF.GetFormFieldType(formID)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
message = message + type + vbCrLf + " style: "
status = gdpicturePDF.GetFormFieldBorderStyle(formID, width, style, dOn, dOff)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
message = message + style.ToString() + " width=" + width.ToString("N2")
If style = PdfAnnotationBorderStyle.PdfAnnotationBorderStyleDashed Then
message = message + "; dash(" + dOn.ToString("N2") + "," + dOff.ToString("N2") + ")"
End If
Else
message = message + gdpicturePDF.GetStat().ToString()
End If
Else
message = message + gdpicturePDF.GetStat().ToString()
End If
message = message + vbCrLf
Else
message = message + "The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
Exit For
End If
Next
If count = 0 Then message = "This file doesn't include forms."
MessageBox.Show(message, caption)
Else
MessageBox.Show("The GetFormFieldsCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetFormFieldBorderStyle";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("forms.pdf", false) == GdPictureStatus.OK)
{
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
int count = gdpicturePDF.GetFormFieldsCount();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
GdPictureStatus status = GdPictureStatus.OK;
string message = "";
int formID = 0;
PdfFormFieldType type = PdfFormFieldType.PdfFormFieldTypeUnknown;
PdfAnnotationBorderStyle style = PdfAnnotationBorderStyle.PdfAnnotationBorderStyleSolid;
float width = 0, dOn = 0, dOff = 0;
for (int i = 0; i < count; i++)
{
formID = gdpicturePDF.GetFormFieldId(i);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
message = message + (i + 1).ToString() + ".field's type: ";
type = gdpicturePDF.GetFormFieldType(formID);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
message = message + type + "\n style: ";
status = gdpicturePDF.GetFormFieldBorderStyle(formID, ref width, ref style, ref dOn, ref dOff);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
message = message + style.ToString() + " width=" + width.ToString("N2");
if (style == PdfAnnotationBorderStyle.PdfAnnotationBorderStyleDashed)
message = message + "; dash(" + dOn.ToString("N2") + "," + dOff.ToString("N2") + ")";
}
else
message = message + gdpicturePDF.GetStat().ToString();
}
else
message = message + gdpicturePDF.GetStat().ToString();
message = message + "\n";
}
else
{
message = message + "The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
break;
}
}
if (count == 0) message = "This file doesn't include forms.";
MessageBox.Show(message, caption);
}
else
MessageBox.Show("The GetFormFieldsCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();
See Also
Reference
GdPicturePDF Class
GdPicturePDF Members
Overload List
SetFormFieldBorderStyle(Int32,Single,PdfAnnotationBorderStyle,Single,Single) Method
GetFormFieldsCount Method
GetFormFieldId Method
GetFormFieldChildID Method
GetFormFieldType Method
AddTextFormField(Single,Single,Single,Single,String,String,Boolean,String,Single,Byte,Byte,Byte) Method
AddPushButtonFormField(Single,Single,Single,Single,String,String,String,Single,Byte,Byte,Byte) Method