Table of Contents

Class PdfXfaRectangleField

Namespace
Syncfusion.Pdf.Xfa
Assembly
Syncfusion.Pdf.Portable.dll

Represents the XFA rectangle field.

public class PdfXfaRectangleField : PdfXfaField
Inheritance
PdfXfaRectangleField
Inherited Members

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.

public PdfXfaRectangleField(string name, SizeF size)

Parameters

name string

Field name.

size SizeF

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, float, float)

Initialize a new instance of the PdfXfaRectangleField class.

public PdfXfaRectangleField(string name, float width, float height)

Parameters

name string

Field name.

width float

Field width.

height float

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

public PdfXfaBorder Border { get; set; }

Property Value

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

public PdfXfaCorner Corner { get; set; }

Property Value

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

public float Height { get; set; }

Property Value

float

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

public PdfXfaRotateAngle Rotate { get; set; }

Property Value

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

public string ToolTip { get; set; }

Property Value

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

public float Width { get; set; }

Property Value

float

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.

public object Clone()

Returns

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()