PdfSize Struct

A size in user space units: 1/72 inch unless a page sets /UserUnit.

public readonly struct PdfSize : IEquatable<PdfSize>
Implements

Constructors

NameDescription
PdfSize(double, double)Initializes a new instance of the PdfSize struct.

PdfSize(double, double)

PdfSize.cs

Initializes a new instance of the PdfSize struct.

public PdfSize(double width, double height)

Parameters

width double
The width, a positive number.
height double
The height, a positive number.

Properties

NameDescription
A3Gets the ISO 216 A3 size, 297 x 420 mm.
A4Gets the ISO 216 A4 size, 210 x 297 mm.
A5Gets the ISO 216 A5 size, 148 x 210 mm.
HeightGets the height.
LegalGets the US Legal size, 8.5 x 14 inches.
LetterGets the US Letter size, 8.5 x 11 inches.
WidthGets the width.

Gets the ISO 216 A3 size, 297 x 420 mm.

public static PdfSize A3 { get; }

Property value

PdfSize

Gets the ISO 216 A4 size, 210 x 297 mm.

public static PdfSize A4 { get; }

Property value

PdfSize

Gets the ISO 216 A5 size, 148 x 210 mm.

public static PdfSize A5 { get; }

Property value

PdfSize

Gets the height.

public double Height { get; }

Property value

double

Gets the US Letter size, 8.5 x 11 inches.

public static PdfSize Letter { get; }

Property value

PdfSize

Gets the width.

public double Width { get; }

Property value

double

Methods

NameDescription
Equals(PdfSize)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
FromMillimeters(double, double)Creates a size from millimeters.
GetHashCode()Returns the hash code for this instance.
ToLandscape()Gets the same size in landscape orientation: the greater dimension is the width.
ToString()Returns the fully qualified type name of this instance.

Equals overloads

Equals(PdfSize)

PdfSize.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(PdfSize other)
Parameters
other PdfSize
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

PdfSize.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

FromMillimeters(double, double)

PdfSize.cs

Creates a size from millimeters.

public static PdfSize FromMillimeters(double width, double height)

Parameters

width double
The width in millimeters.
height double
The height in millimeters.

Returns

PdfSize The size in points.

GetHashCode()

PdfSize.cs

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

ToLandscape()

PdfSize.cs

Gets the same size in landscape orientation: the greater dimension is the width.

public PdfSize ToLandscape()

Returns

PdfSize The size.

ToString()

PdfSize.cs

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string The fully qualified type name.

Operators

NameDescription
operator ==(PdfSize, PdfSize)Indicates whether two sizes are equal.
operator !=(PdfSize, PdfSize)Indicates whether two sizes are different.

operator ==(PdfSize, PdfSize)

PdfSize.cs

Indicates whether two sizes are equal.

public static bool operator ==(PdfSize left, PdfSize right)

Parameters

left PdfSize
The first size.
right PdfSize
The second size.

Returns

bool true when the sizes are equal.

operator !=(PdfSize, PdfSize)

PdfSize.cs

Indicates whether two sizes are different.

public static bool operator !=(PdfSize left, PdfSize right)

Parameters

left PdfSize
The first size.
right PdfSize
The second size.

Returns

bool true when the sizes are different.