cete.dynamicpdf.page
Page
- Namespace: ceTe.DynamicPDF
- Assemblies: DynamicPDF.CoreSuite.dll
Represents a page.
public class Page
Public Class Page
Inheritance: Object → Page
Derived: AppendedPage, ImportedPage
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 create pages to add to your Document .
Constructors
Page()
Initializes a new instance of the Page class.
public Page()
Public Sub New ()
Page(PageDimensions)
Initializes a new instance of the Page class.
public Page(PageDimensions dimensions)
Public Sub New (dimensions As PageDimensions)
Parameters
- dimensions: PageDimensions
The PageDimensions of the page.
Page(PageSize)
Initializes a new instance of the Page class.
public Page(PageSize size)
Public Sub New (size As PageSize)
Parameters
- size: PageSize
The PageSize representing the dimensions of the page.
Page(PageSize, PageOrientation)
Initializes a new instance of the Page class.
public Page(PageSize size, PageOrientation orientation)
Public Sub New (size As PageSize, orientation As PageOrientation)
Parameters
- size: PageSize
The PageSize representing the dimensions of the page.
- orientation: PageOrientation
The PageOrientation of the page.
Page(PageSize, PageOrientation, Single)
Initializes a new instance of the Page class.
public Page(PageSize size, PageOrientation orientation, float margins)
Public Sub New (size As PageSize, orientation As PageOrientation, margins As Single)
Parameters
- size: PageSize
The PageSize representing the dimensions of the page.
- orientation: PageOrientation
The PageOrientation of the page.
- margins: Single
The margins of the page.
Page(PageSize, Single)
Initializes a new instance of the Page class.
public Page(PageSize size, float margins)
Public Sub New (size As PageSize, margins As Single)
Parameters
- size: PageSize
The PageSize representing the dimensions of the page.
- margins: Single
The margins of the page.
Page(Single, Single)
Initializes a new instance of the Page class.
public Page(float width, float height)
Public Sub New (width As Single, height As Single)
Parameters
- width: Single
The width of the page.
- height: Single
The height of the page.
Page(Single, Single, Single)
Initializes a new instance of the Page class.
public Page(float width, float height, float margins)
Public Sub New (width As Single, height As Single, margins As Single)
Parameters
- width: Single
The width of the page.
- height: Single
The height of the page.
- margins: Single
The margins of the page.
Properties
ApplyDocumentTemplate
Gets or sets a value indicating if this page uses the documents template.
public bool ApplyDocumentTemplate { get; set; }
Public Property ApplyDocumentTemplate As Boolean
Property Value
ApplySectionTemplate
Gets or sets a value indicating if this page uses the sections template.
public bool ApplySectionTemplate { get; set; }
Public Property ApplySectionTemplate As Boolean
Property Value
Dimensions
Gets or sets the dimensions of the page.
public PageDimensions Dimensions { get; set; }
Public Property Dimensions As PageDimensions
Property Value
Elements
Gets a collection of page elements.
public Group Elements { get; }
Public Property Elements As Group
Property Value
ReaderEvents
Gets the reader events of the page.
public PageReaderEvents ReaderEvents { get; }
Public Property ReaderEvents As PageReaderEvents
Property Value
Rotate
Gets or sets the rotation of the page.
public int Rotate { get; set; }
Public Property Rotate As Int32
Property Value
UnderlyingElements
Gets a collection of page elements that will appear beneath (behind) the page elements from the Elements property.
public Group UnderlyingElements { get; }
Public Property UnderlyingElements As Group
Property Value
Methods
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
- obj: Object
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 .
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.
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 .