PageDimensions
Represents the dimensions of a page.
public class PageDimensions : AreaDimensions
Public Class PageDimensions
Inherits AreaDimensions
Inheritance: ObjectAreaDimensionsPageDimensions
Derived: AutoPageDimensions, ExtendedPageDimensions
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 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. |
PageDimensions(Dimensions, Dimensions) | Initializes a new instance of the PageDimensions class. |
PageDimensions(Dimensions, Single) | Initializes a new instance of the PageDimensions class. |
PageDimensions(PageSize) | Initializes a new instance of the PageDimensions class. |
PageDimensions(PageSize, PageOrientation) | Initializes a new instance of the PageDimensions class. |
PageDimensions(PageSize, PageOrientation, Single) | Initializes a new instance of the PageDimensions class. |
PageDimensions(PageSize, Single) | Initializes a new instance of the PageDimensions class. |
PageDimensions(Single, Single) | Initializes a new instance of the PageDimensions class. |
PageDimensions(Single, Single, Single) | Initializes a new instance of the PageDimensions class. |
Properties
ArtBox | Gets the art box dimensions of the page in points (1/72 inches). |
BleedBox | Gets the bleed box dimensions of the page in points (1/72 inches). |
Body | Represents the dimensions of the areas body. (Inherited from AreaDimensions) |
BottomMargin | Gets or sets the bottom margin of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions) |
CropBox | Gets the crop box dimensions of the page in points (1/72 inches). |
Edge | Represents the dimensions of the areas edge. (Inherited from AreaDimensions) |
Height | Gets or sets the height of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions) |
LeftMargin | Gets or sets the left margin of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions) |
MediaBox | Gets the media box dimensions of the page in points (1/72 inches). |
RightMargin | Gets or sets the right margin of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions) |
TopMargin | Gets or sets the top margin of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions) |
TrimBox | Gets the trim box dimensions of the page in points (1/72 inches). |
Width | Gets or sets the width of the page dimensions in points (1/72 inches). (Inherited from AreaDimensions) |
Methods
Draw(DocumentWriter) | Draws the page dimensions to the given DocumentWriter object. |
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) |
GetPdfX(Single) | Gets the translated X coordinate. (Inherited from AreaDimensions) |
GetPdfX(Single, RelativeTo, Boolean) | Gets the translated X coordinate. (Inherited from AreaDimensions) |
GetPdfY(Single) | Gets the translated Y coordinate. |
GetPdfY(Single, RelativeTo, Boolean) | Gets the translated Y coordinate. |
GetType() | Gets the Type of the current instance. (Inherited from Object) |
SetMargins(Single) | Sets all of the margins for the page dimensions in points (1/72 inches). |
SetMargins(Single, Single) | Sets all of the margins of the page in points (1/72 inches). |
SetMargins(Single, Single, Single, Single) | Sets all of the margins of the page in points (1/72 inches). |
ToString() | Returns a String that represents the current Object . (Inherited from Object) |