VegaRise.NET
Back to DOM

PageSizeClass

Definition

Namespace
DOM.Elements
Assembly
DOM.dll

Describes the physical size of a page.

Remarks

supports common named paper sizes (A4, A5, Letter, Legal) as well as custom sizes expressed using a instance. PageSize Dimensions The class holds a instance representing width and height (and units). Setting the property will update the stored to the canonical dimensions for that paper. Conversely, assigning attempts to map the provided dimensions back to a known value; if no match is found the becomes . Dimensions Paper CustomSize CustomSize PaperSize Paper Custom

Examples

csharp
1// 1. Default constructor (A4)
2var page = new PageSize(); // 8.27in × 11.69in
3
csharp
1// 2. Named paper size
2var letter = new PageSize(PaperSize.Letter);
3Console.WriteLine(letter.CustomSize.Width.Inch); // 8.5
4
csharp
1// 3. Custom size in centimeters
2var custom = new PageSize(21.0, 29.7, Units.cm);
3Console.WriteLine(custom.Paper); // A4 (auto-detected)
4
csharp
1// 4. Change paper size after construction
2var page = new PageSize();
3page.Paper = PaperSize.Legal;
4Console.WriteLine(page.CustomSize.Height.Inch); // 14
5

Constructors

PageSize()

Initializes a new instance of using the default dimensions. The default value is A4 (8.27in × 11.69in). PageSize

PageSize(double width, double height, Units units)

Initializes a new instance of with a custom width and height using the specified units. PageSize

PageSize(PaperSize paper)

Initializes a new instance of using a predefined . PageSize, PaperSize

Properties

CustomSizeDimensions

Gets or sets the custom page dimensions.

Assigning a instance updates the internal measurements and will attempt to recognize the dimensions as one of the known values by comparing the width/height in inches against canonical values: - A4 = 8.27in × 11.69in - A5 = 5.83in × 8.27in - Letter = 8.5in × 11in - Legal = 8.5in × 14in If an exact match is not found the is set to . Note: the comparison is an exact numeric comparison of the inch values as implemented. Dimensions PaperSize Paper Custom

Gets or sets the named paper size.

When set to a known paper size (A4, A5, Letter, Legal) the is updated to the canonical dimensions for that paper (values stored in inches). Setting to will not change . CustomSize Custom CustomSize

VegaRiseVDocs.NET

Reset Password

Enter your email and we'll send you a link to reset your password.

Remember your password? Sign in