Skip to main content

PageDimensions

Version: 10.0

cete.dynamicpdf.pagedimensions

PageDimensions​

  • Namespace: ceTe.DynamicPDF
  • Assemblies: DynamicPDF.NETFramework40.dll, DynamicPDF.NETStandard20.dll

Represents the dimensions of a page.

public class PageDimensions : AreaDimensions
Public Class PageDimensions
Inherits AreaDimensions

Inheritance: Object → AreaDimensions → PageDimensions

Derived: ExtendedPageDimensions

Licensing​

This class is a DynamicPDF Generator Community Edition feature.

Examples​

The following example creates a new page using a PageDimensions to set the margins of that page.
It then places a label on the page and rotates the page 90 degrees.

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 dimensions object and set the margins
Dim dimensions As PageDimensions = New PageDimensions(PageSize.Letter, PageOrientation.Portrait)
dimensions.BottomMargin = 50
dimensions.TopMargin = 50
dimensions.LeftMargin = 35
dimensions.RightMargin = 35

' Create a page using a page dimensions object and add it to the document
Dim MyPage As Page = New Page(dimensions)
MyDocument.Pages.Add(MyPage)

' Add a label to the page
MyPage.Elements.Add(New Label("this page was rotated 90 degrees.", 0, 0, 300, 20, Font.Helvetica, 18))

' Rotate the page 90 degrees
MyPage.Rotate = 90

' 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 dimensions object and set the margins
PageDimensions dimensions = new PageDimensions( PageSize.Letter, PageOrientation.Portrait );
dimensions.BottomMargin = 50;
dimensions.TopMargin = 50;
dimensions.LeftMargin = 35;
dimensions.RightMargin = 35;

// Create a page using a page dimensions object and add it to the document
Page page = new Page( dimensions );
document.Pages.Add( page );

// Add a label to the page
page.Elements.Add( new Label( "This page was rotated 90 degrees.", 0, 0, 300, 20, Font.Helvetica, 18 ) );

// Rotate the page 90 degrees
page.Rotate = 90;
// Save the PDF
document.Draw( outputPath );
}
}

Remarks​

This class can be used to specify the dimensions and other formatting details of a page. It can then be passed into a Page constructor.

Constructors​

PageDimensions(Dimensions)​

Initializes a new instance of the PageDimensions class.

public PageDimensions(Dimensions edgeDimensions)
Public Sub New (edgeDimensions As Dimensions)

Parameters​

Edge dimensions of the page dimensions in points (1/72 inches).

PageDimensions(Dimensions, Dimensions)​

Initializes a new instance of the PageDimensions class.

public PageDimensions(Dimensions edgeDimensions, Dimensions marginDimensions)
Public Sub New (edgeDimensions As Dimensions, marginDimensions As Dimensions)

Parameters​

Edge dimensions of the page dimensions in points (1/72 inches).

Margin dimensions of the page dimensions in points (1/72 inches).

PageDimensions(Dimensions, Single)​

Initializes a new instance of the PageDimensions class.

public PageDimensions(Dimensions edgeDimensions, float margins)
Public Sub New (edgeDimensions As Dimensions, margins As Single)

Parameters​

Edge dimensions of the page dimensions in points (1/72 inches).

Margins of the page dimensions in points (1/72 inches).

PageDimensions(PageSize)​

Initializes a new instance of the PageDimensions class.

public PageDimensions(PageSize size)
Public Sub New (size As PageSize)

Parameters​

Page size of the page dimensions in points (1/72 inches).

PageDimensions(PageSize, PageOrientation)​

Initializes a new instance of the PageDimensions class.

public PageDimensions(PageSize size, PageOrientation orientation)
Public Sub New (size As PageSize, orientation As PageOrientation)

Parameters​

Page size of the page dimensions in points (1/72 inches).

PageDimensions(PageSize, PageOrientation, Single)​

Initializes a new instance of the PageDimensions class.

public PageDimensions(PageSize size, PageOrientation orientation, float margins)
Public Sub New (size As PageSize, orientation As PageOrientation, margins As Single)

Parameters​

Page size of the page dimensions in points (1/72 inches).

Orientation of the page dimensions in points (1/72 inches).

Margins of the page dimensions in points (1/72 inches).

PageDimensions(PageSize, Single)​

Initializes a new instance of the PageDimensions class.

public PageDimensions(PageSize size, float margins)
Public Sub New (size As PageSize, margins As Single)

Parameters​

Page size of the page dimensions in points (1/72 inches).

Margins of the page dimensions in points (1/72 inches).

PageDimensions(Single, Single)​

Initializes a new instance of the PageDimensions class.

public PageDimensions(float width, float height)
Public Sub New (width As Single, height As Single)

Parameters​

Width of the page dimensions in points (1/72 inches).

Height of the page dimensions in points (1/72 inches).

PageDimensions(Single, Single, Single)​

Initializes a new instance of the PageDimensions class.

public PageDimensions(float width, float height, float margins)
Public Sub New (width As Single, height As Single, margins As Single)

Parameters​

Width of the page dimensions in points (1/72 inches).

Height of the page dimensions in points (1/72 inches).

Margins of the page dimensions in points (1/72 inches).

Properties​

Body​

Represents the dimensions of the areas body. (Inherited from AreaDimensions)

public Dimensions Body { get; }
Public Property Body As Dimensions

Property Value​

Dimensions

BottomMargin​

Gets or sets the bottom margin of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions)

public float BottomMargin { get; set; }
Public Property BottomMargin As Single

Property Value​

Single

Edge​

Represents the dimensions of the areas edge. (Inherited from AreaDimensions)

public Dimensions Edge { get; }
Public Property Edge As Dimensions

Property Value​

Dimensions

Height​

Gets or sets the height of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions)

public float Height { get; set; }
Public Property Height As Single

Property Value​

Single

LeftMargin​

Gets or sets the left margin of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions)

public float LeftMargin { get; set; }
Public Property LeftMargin As Single

Property Value​

Single

RightMargin​

Gets or sets the right margin of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions)

public float RightMargin { get; set; }
Public Property RightMargin As Single

Property Value​

Single

TopMargin​

Gets or sets the top margin of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions)

public float TopMargin { get; set; }
Public Property TopMargin As Single

Property Value​

Single

Width​

Gets or sets the width of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions)

public float Width { get; set; }
Public Property Width As Single

Property Value​

Single

Methods​

Draw(DocumentWriter)​

Draws the page dimensions to the given DocumentWriter object.

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

Parameters​

DocumentWriter to receive the page dimensions output.

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.

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 .

GetPdfX(Single)​

Returns the translated X coordinate. (Inherited from AreaDimensions)

public float GetPdfX(float x)
Function GetPdfX(x As Single) As Single

Parameters​

X coordinate to translate.

Returns​

A translated X coordinate.

GetPdfY(Single)​

Gets the translated Y coordinate.

public float GetPdfY(float y)
Function GetPdfY(y As Single) As Single

Parameters​

Y coordinate to translate.

Returns​

A translated Y coordinate.

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.

SetMargins(Single)​

Sets all of the margins for the page dimensions in points (1/72 inches).

public void SetMargins(float margins)
Sub SetMargins(margins As Single)

Parameters​

Margins value in points (1/72 inches) to set.

SetMargins(Single, Single)​

Sets all of the margins of the page in points (1/72 inches).

public void SetMargins(float leftAndRight, float topAndBottom)
Sub SetMargins(leftAndRight As Single, topAndBottom As Single)

Parameters​

Left and right margin value in points (1/72 inches) to set.

Top and bottom margin value in points (1/72 inches) to set.

SetMargins(Single, Single, Single, Single)​

Sets all of the margins of the page in points (1/72 inches).

public void SetMargins(float leftMargin, float topMargin, float rightMargin, float bottomMargin)
Sub SetMargins(leftMargin As Single, topMargin As Single, rightMargin As Single, bottomMargin As Single)

Parameters​

Left margin value in points (1/72 inches) to set.

Top margin value in points (1/72 inches) to set.

Right margin value in points (1/72 inches) to set.

Bottom margin value in points (1/72 inches) to set.

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 .

See Also​

ceTe.DynamicPDF