Class PdfXfaRectangleField
Represents the XFA rectangle field.
Namespace: Syncfusion.Pdf.Xfa
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfXfaRectangleField : PdfXfaField
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a rectangle field and add the properties.
PdfXfaRectangleField rectangle = new PdfXfaRectangleField("rect1", new SizeF(100, 50));
//Set the fill color
rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.Red);
//Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a rectangle field and add the properties.
Dim rectangle As New PdfXfaRectangleField("rect1", New SizeF(100,50))
'Set the fill color
rectangle.Border.FillColor = New PdfXfaSolidBrush(Color.Red)
'Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()
Constructors
PdfXfaRectangleField(String, SizeF)
Initialize a new instance of the PdfXfaRectangleField class.
Declaration
public PdfXfaRectangleField(string name, SizeF size)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Field name. |
SizeF | size | Field size. |
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a rectangle field and add the properties.
PdfXfaRectangleField rectangle = new PdfXfaRectangleField("rect1", new SizeF(100, 50));
//Set the fill color
rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.Red);
//Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a rectangle field and add the properties.
Dim rectangle As New PdfXfaRectangleField("rect1", New SizeF(100,50))
'Set the fill color
rectangle.Border.FillColor = New PdfXfaSolidBrush(Color.Red)
'Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()
PdfXfaRectangleField(String, Single, Single)
Initialize a new instance of the PdfXfaRectangleField class.
Declaration
public PdfXfaRectangleField(string name, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Field name. |
System.Single | width | Field width. |
System.Single | height | Field height. |
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a rectangle field and add the properties.
PdfXfaRectangleField rectangle = new PdfXfaRectangleField("rect1", 100, 50);
//Set the fill color
rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.Red);
//Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a rectangle field and add the properties.
Dim rectangle As New PdfXfaRectangleField("rect1", 100,50)
'Set the fill color
rectangle.Border.FillColor = New PdfXfaSolidBrush(Color.Red)
'Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()
Properties
Border
Gets or sets the border
Declaration
public PdfXfaBorder Border { get; set; }
Property Value
Type |
---|
PdfXfaBorder |
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a rectangle field and add the properties.
PdfXfaRectangleField rectangle = new PdfXfaRectangleField("rect1", new SizeF(100, 50));
//Set the fill color
rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.Red);
//Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a rectangle field and add the properties.
Dim rectangle As New PdfXfaRectangleField("rect1", New SizeF(100,50))
'Set the fill color
rectangle.Border.FillColor = New PdfXfaSolidBrush(Color.Red)
'Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()
Corner
Gets or sets the cornor shaps
Declaration
public PdfXfaCorner Corner { get; set; }
Property Value
Type |
---|
PdfXfaCorner |
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Create a form.
PdfXfaForm parentForm = new PdfXfaForm(PdfXfaFlowDirection.Vertical, 595);
parentForm.Margins.All = 10;
//Create new XFA rectangle instance.
PdfXfaRectangleField rect = new PdfXfaRectangleField("rect1", new SizeF(200, 100));
//Create a new corner instance.
PdfXfaCorner corner = new PdfXfaCorner();
//Set inverted.
corner.IsInverted = true;
//Set corner shape.
corner.Shape = PdfXfaCornerShape.Round;
//Set corner thickness
corner.Thickness = 5;
//Set corner border color.
corner.BorderColor = Color.Green;
//Set the corner border style.
corner.BorderStyle = PdfXfaBorderStyle.Solid;
//Set the radius of the corner.
corner.Radius = 5f;
//Set the visibility of the corner.
corner.Visibility = PdfXfaVisibility.Visible;
//Set the corner of the rectangle
rect.Corner = corner;
//Set the fill color of the rectangle
rect.Border.Style = PdfXfaBorderStyle.Solid;
//Set rectangle border width.
rect.Border.Width = 5;
//Set the linear brush
rect.Border.FillColor = new PdfXfaLinearBrush(Color.Red, Color.Yellow);
//Add the field to form.
parentForm.Fields.Add(rect);
document.XfaForm = parentForm;
//Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic);
//Close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Create a form.
Dim parentForm As New PdfXfaForm(PdfXfaFlowDirection.Vertical, 595)
parentForm.Margins.All = 10
'Create new XFA rectangle instance.
Dim rect As New PdfXfaRectangleField("rect1", New SizeF(200, 100))
'Create a new corner instance.
Dim corner As New PdfXfaCorner()
'Set inverted.
corner.IsInverted = True
'Set corner shape.
corner.Shape = PdfXfaCornerShape.Round
'Set corner thickness
corner.Thickness = 5
'Set corner border color.
corner.BorderColor = Color.Green
'Set the corner border style.
corner.BorderStyle = PdfXfaBorderStyle.Solid
'Set the radius of the corner.
corner.Radius = 5F
'Set the visibility of the corner.
corner.Visibility = PdfXfaVisibility.Visible
'Set the corner of the rectangle
rect.Corner = corner
'Set the fill color of the rectangle
rect.Border.Style = PdfXfaBorderStyle.Solid
'Set rectangle border width.
rect.Border.Width = 5
'Set the linear brush
rect.Border.FillColor = New PdfXfaLinearBrush(Color.Red, Color.Yellow)
'Add the field to form.
parentForm.Fields.Add(rect)
document.XfaForm = parentForm
'Save the document.
document.Save("output.pdf", PdfXfaType.Dynamic)
'Close the document
document.Close()
Height
Gets sets height of the field
Declaration
public float Height { get; set; }
Property Value
Type |
---|
System.Single |
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a rectangle field and add the properties.
PdfXfaRectangleField rectangle = new PdfXfaRectangleField("rect1", new SizeF(100, 50));
//Set the fill color
rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.Red);
//Set height.
rectangle.Height = 100;
//Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a rectangle field and add the properties.
Dim rectangle As New PdfXfaRectangleField("rect1", New SizeF(100,50))
'Set the fill color
rectangle.Border.FillColor = New PdfXfaSolidBrush(Color.Red)
'Set height.
rectangle.Height = 100
'Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()
Rotate
Gets or sets the rotation angle
Declaration
public PdfXfaRotateAngle Rotate { get; set; }
Property Value
Type |
---|
PdfXfaRotateAngle |
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a rectangle field and add the properties.
PdfXfaRectangleField rectangle = new PdfXfaRectangleField("rect1", new SizeF(100, 50));
//Set the fill color
rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.Red);
//Set rotation.
rectangnle.Rotate = PdfXfaRotateAngle.RotateAngle90;
//Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a rectangle field and add the properties.
Dim rectangle As New PdfXfaRectangleField("rect1", New SizeF(100,50))
'Set the fill color
rectangle.Border.FillColor = New PdfXfaSolidBrush(Color.Red)
'Set rotation.
rectangnle.Rotate = PdfXfaRotateAngle.RotateAngle90
'Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()
ToolTip
Gets or sets the tool tip
Declaration
public string ToolTip { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a rectangle field and add the properties.
PdfXfaRectangleField rectangle = new PdfXfaRectangleField("rect1", new SizeF(100, 50));
//Set the fill color
rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.Red);
//Set tool tip.
rectangle.ToolTip ="This the rectangle";
//Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a rectangle field and add the properties.
Dim rectangle As New PdfXfaRectangleField("rect1", New SizeF(100,50))
'Set the fill color
rectangle.Border.FillColor = New PdfXfaSolidBrush(Color.Red)
'Set tool tip.
rectangle.ToolTip = "This is the rectangle"
'Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()
Width
Gets or sets width of the field
Declaration
public float Width { get; set; }
Property Value
Type |
---|
System.Single |
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a rectangle field and add the properties.
PdfXfaRectangleField rectangle = new PdfXfaRectangleField("rect1", new SizeF(100, 50));
//Set the fill color
rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.Red);
//Set width.
rectangle.Width = 150;
//Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a rectangle field and add the properties.
Dim rectangle As New PdfXfaRectangleField("rect1", New SizeF(100,50))
'Set the fill color
rectangle.Border.FillColor = New PdfXfaSolidBrush(Color.Red)
'Set width.
rectangle.Width = 150
'Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()
Methods
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | The copy of the new object for this instance. |
Examples
//Create a new PDF XFA document.
PdfXfaDocument document = new PdfXfaDocument();
//Add a new XFA page.
PdfXfaPage xfaPage = document.Pages.Add();
//Create a new PDF XFA form
PdfXfaForm mainForm = new PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width);
//Create a rectangle field and add the properties.
PdfXfaRectangleField rectangle = new PdfXfaRectangleField("rect1", new SizeF(100, 50));
//Set the fill color
rectangle.Border.FillColor = new PdfXfaSolidBrush(Color.Red);
//Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle);
//Clone the rectangle field.
mainForm.Fields.Add(rectangle.Clone() as PdfXfaRectangleField);
//Add the XFA form to the document.
document.XfaForm = mainForm;
//Save the document.
document.Save("XfaForm.pdf", PdfXfaType.Dynamic);
//close the document
document.Close();
'Create a new PDF XFA document.
Dim document As New PdfXfaDocument()
'Add a new XFA page.
Dim xfaPage As PdfXfaPage = document.Pages.Add()
'Create a new PDF XFA form
Dim mainForm As New PdfXfaForm("subform1", xfaPage, xfaPage.GetClientSize().Width)
'Create a rectangle field and add the properties.
Dim rectangle As New PdfXfaRectangleField("rect1", New SizeF(100,50))
'Set the fill color
rectangle.Border.FillColor = New PdfXfaSolidBrush(Color.Red)
'Add the rectangle field to the XFA form.
mainForm.Fields.Add(rectangle)
'Clone the rectangle field.
mainForm.Fields.Add(TryCase(rectangle.Clone(), PdfXfaRectangleField)
'Add the XFA form to the document.
document.XfaForm = mainForm
'Save the document.
document.Save("XfaForm.pdf",PdfXfaType.Dynamic)
'close the document
document.Close()