Rectangle
Represents a rectangle page element.
public class Rectangle : RotatingPageElement, IArea, ICoordinate, ISerializable
Public Class Rectangle
Inherits RotatingPageElement
Implements IArea, ICoordinate, ISerializable
Inheritance: ObjectPageElementTaggablePageElementRotatingPageElementRectangle
Implements: IArea, ICoordinate, ISerializable
Licensing Info
This class is a DynamicPDF Core Suite Essentials feature. One of the following is required for non-evaluation usage:
- Any active DynamicPDF Subscription (Essentials, Professional, Professional Plus or Ultimate).
- A DynamicPDF Core Suite for .NET v12.X Essentials license.
- It can also be used for free with a public link back to www.dynamicpdf.com and with the DynamicPDF Essentials message displaying on the bottom of each page.
Examples
The following example will display a custom rectangle on the page.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create a rectangle
Dim MyRectangle As Rectangle = New Rectangle(50, 50, 200, _
200, Grayscale.Black, RgbColor.Gray, 4, LineStyle.Solid)
' Change the corner radius property
MyRectangle.CornerRadius = 10
' Add the rectangle to the page
MyPage.Elements.Add(MyRectangle)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page);
// Create a rectangle
Rectangle rectangle = new Rectangle(50, 50, 200, 200,
Grayscale.Black, RgbColor.Gray, 4, LineStyle.Solid);
// Change the corner radius property
rectangle.CornerRadius = 10;
// Add the rectangle to the page
page.Elements.Add(rectangle);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This class can be used to place rectangles of any size or color on a page.
Constructors
Properties
Angle | Gets or sets the heights of the angle element. (Inherited from RotatingPageElement) |
BorderColor | Gets or sets the Color object to use for the border of the rectangle. |
BorderStyle | Gets or sets the LineStyle object used to specify the border style of the rectangle. |
BorderWidth | Gets or sets the border width of the rectangle. |
CornerRadius | Gets or sets the corner radius of the rectangle. |
FillColor | Gets or sets the Color object to use for the fill of the rectangle. |
Height | Gets or sets the heights of the page element. (Inherited from RotatingPageElement) |
ID | Gets or sets the ID of the page element. (Inherited from PageElement) |
IgnoreMargins | Gets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property. (Inherited from PageElement) |
RelativeTo | Gets and sets placement of the page element on the page. (Inherited from PageElement) |
Tag | Gets or sets the tag of the taggable element. (Inherited from TaggablePageElement) |
TagOrder | Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement) |
Width | Gets or sets the width of the rectangle. |
X | Gets or sets the X coordinate of the page element. (Inherited from RotatingPageElement) |
Y | Gets or sets the Y coordinate of the page element. (Inherited from RotatingPageElement) |
Methods
Draw(PageWriter) | Draws the page element to the given PageWriter object. (Inherited from RotatingPageElement) |
Equals(Object) | Determines whether the specified Object is equal to the current Object . (Inherited from Object) |
GetHashCode() | Serves as a hash function for a particular type. (Inherited from Object) |
GetType() | Gets the Type of the current instance. (Inherited from Object) |
ToString() | Returns a String that represents the current Object . (Inherited from Object) |