Skip to main content

LayoutGrid

Version: 12.0

cete.dynamicpdf.pageelements.layoutgrid

LayoutGrid​

Represents a layout grid.

public class LayoutGrid : PageElement, ISerializable
Public Class LayoutGrid
Inherits PageElement
Implements ISerializable

Inheritance: Object → PageElement → LayoutGrid

Implements: ISerializable

Licensing Info​

This class is a DynamicPDF Core Suite Essentials feature. One of the following is required for non-evaluation usage:

Examples​

The following example will place a layout grid on the page and also places a rectangle on the page for reference.

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 layout grid
Dim grid As LayoutGrid = New LayoutGrid(LayoutGrid.GridType.Decimal)

' Add a rectangle to the page
MyPage.Elements.Add(New Rectangle(50, 50, 50, 50, 2))

' Add the layout grid to the page
MyPage.Elements.Add(grid)

' 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 layout grid
LayoutGrid grid = new LayoutGrid(LayoutGrid.GridType.Decimal);

// Add a rectangle to the page
page.Elements.Add(new Rectangle(50, 50, 50, 50, 2));

// Add the layout grid to the page
page.Elements.Add(grid);

// Save the PDF
document.Draw(outputPath);
}
}

Remarks​

This class can be used to place a grid on the entire page. This grid is very helpful with the design and layout of the document.

Constructors​

LayoutGrid()​

Initializes a new instance of the LayoutGrid class.

public LayoutGrid()
Public Sub New ()

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

LayoutGrid(Boolean)​

Initializes a new instance of the LayoutGrid class.

public LayoutGrid(bool showTitle)
Public Sub New (showTitle As Boolean)

Parameters​

This value specifies whether or not to display the grid's title information.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

LayoutGrid(LayoutGrid.GridType)​

Initializes a new instance of the LayoutGrid class.

public LayoutGrid(GridType type)
Public Sub New (type As GridType)

Parameters​

Type of grid to display.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

LayoutGrid(LayoutGrid.GridType, Boolean)​

Initializes a new instance of the LayoutGrid class.

public LayoutGrid(GridType type, bool showTitle)
Public Sub New (type As GridType, showTitle As Boolean)

Parameters​

Type of grid to display.

This value specifies whether or not to display the grid's title information.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Properties​

ID​

Gets or sets the ID of the page element. (Inherited from PageElement)

public string ID { get; set; }
Public Property ID As String

Property Value​

String

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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)

public bool IgnoreMargins { get; set; }
Public Property IgnoreMargins As Boolean

Property Value​

Boolean

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

The following example will place the Label in the top-left of the page with IgnoreMargin

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 an Label and place it in page top left with margin ignored
Label label = new Label("I am placed in Page top left with margin ignored", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
label.IgnoreMargin=true; page.Elements.Add(label);

// Save the PDF
document.Draw(outputPath);
}
}

RelativeTo​

Gets and sets placement of the page element on the page. (Inherited from PageElement)

public RelativeTo RelativeTo { get; set; }
Public Property RelativeTo As RelativeTo

Property Value​

RelativeTo

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

The following example will place the Label in the top-left of the page.

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 an Label and place it in page top left with margin
Label label = new Label("I am placed in Page top left with margin.", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
page.Elements.Add(label);

// Save the PDF
document.Draw(outputPath);
}
}

ShowTitle​

Gets or sets a value specifying whether or not to display the grids title information.

public bool ShowTitle { get; set; }
Public Property ShowTitle As Boolean

Property Value​

Boolean

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Type​

Gets or sets the style of grid.

public GridType Type { get; set; }
Public Property Type As GridType

Property Value​

GridType

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Methods​

Draw(PageWriter)​

Draws the layout grid to the given PageWriter object.

public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)

Parameters​

PageWriter object to receive the layout grid's output.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Equals(Object)​

Determines whether the specified Object is equal to the current Object . (Inherited from Object)

public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean

Parameters​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

GetHashCode()​

Serves as a hash function for a particular type. (Inherited from Object)

public int GetHashCode()
Function GetHashCode() As Integer

Returns​

A hash code for the current Object .

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

GetType()​

Gets the Type of the current instance. (Inherited from Object)

public Type GetType()
Function GetType() As Type

Returns​

The Type instance that represents the exact runtime type of the current instance.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

ToString()​

Returns a String that represents the current Object . (Inherited from Object)

public string ToString()
Function ToString() As String

Returns​

A String that represents the current Object .

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

See Also​

ceTe.DynamicPDF.PageElements