PdfVersion Struct

A version of the PDF format, such as 1.7 or 2.0.

public readonly struct PdfVersion : IComparable<PdfVersion>, IEquatable<PdfVersion>
Implements

Constructors

NameDescription
PdfVersion(int, int)Initializes a new instance of the PdfVersion struct.

PdfVersion(int, int)

PdfVersion.cs

Initializes a new instance of the PdfVersion struct.

public PdfVersion(int major, int minor)

Parameters

major int
The major version, 1 or 2.
minor int
The minor version, from 0 to 9.

Properties

NameDescription
MajorGets the major version.
MinorGets the minor version.
Pdf14Gets PDF 1.4.
Pdf15Gets PDF 1.5, the first version with object streams and cross-reference streams.
Pdf16Gets PDF 1.6.
Pdf17Gets PDF 1.7 (ISO 32000-1).
Pdf20Gets PDF 2.0 (ISO 32000-2).

Gets the major version.

public int Major { get; }

Property value

int

Gets the minor version.

public int Minor { get; }

Property value

int

Gets PDF 1.4.

public static PdfVersion Pdf14 { get; }

Property value

PdfVersion

Gets PDF 1.5, the first version with object streams and cross-reference streams.

public static PdfVersion Pdf15 { get; }

Property value

PdfVersion

Gets PDF 1.6.

public static PdfVersion Pdf16 { get; }

Property value

PdfVersion

Gets PDF 1.7 (ISO 32000-1).

public static PdfVersion Pdf17 { get; }

Property value

PdfVersion

Gets PDF 2.0 (ISO 32000-2).

public static PdfVersion Pdf20 { get; }

Property value

PdfVersion

Methods

NameDescription
CompareTo(PdfVersion)Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Equals(PdfVersion)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.
GetHashCode()Returns the hash code for this instance.
Max(PdfVersion, PdfVersion)Returns the greater of two versions.
ToString()Returns the version as a PDF header writes it, such as 1.7.
TryParse(string?, PdfVersion)Parses a version written as in a PDF header, such as 1.7.

CompareTo(PdfVersion)

PdfVersion.cs

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(PdfVersion other)

Parameters

other PdfVersion
An object to compare with this instance.

Returns

int A value that indicates the relative order of the objects being compared. The return value has these meanings:

ValueMeaning
Less than zeroThis instance precedes other in the sort order.
ZeroThis instance occurs in the same position in the sort order as other.
Greater than zeroThis instance follows other in the sort order.

Equals overloads

Equals(PdfVersion)

PdfVersion.cs

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

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

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

Equals(object?)

PdfVersion.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.

GetHashCode()

PdfVersion.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.

Max(PdfVersion, PdfVersion)

PdfVersion.cs

Returns the greater of two versions.

public static PdfVersion Max(PdfVersion left, PdfVersion right)

Parameters

left PdfVersion
The first version.
right PdfVersion
The second version.

Returns

PdfVersion The greater version.

ToString()

PdfVersion.cs

Returns the version as a PDF header writes it, such as 1.7.

public override string ToString()

Returns

string The version.

TryParse(string?, PdfVersion)

PdfVersion.cs

Parses a version written as in a PDF header, such as 1.7.

public static bool TryParse(string? value, out PdfVersion version)

Parameters

value string?
The text.
version PdfVersion
The version.

Returns

bool true when the text is a version.

Operators

NameDescription
operator ==(PdfVersion, PdfVersion)Indicates whether two versions are equal.
operator >(PdfVersion, PdfVersion)Indicates whether a version is greater than another one.
operator >=(PdfVersion, PdfVersion)Indicates whether a version is greater than or equal to another one.
operator !=(PdfVersion, PdfVersion)Indicates whether two versions are different.
operator <(PdfVersion, PdfVersion)Indicates whether a version is lower than another one.
operator <=(PdfVersion, PdfVersion)Indicates whether a version is lower than or equal to another one.

operator ==(PdfVersion, PdfVersion)

PdfVersion.cs

Indicates whether two versions are equal.

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

Parameters

left PdfVersion
The first version.
right PdfVersion
The second version.

Returns

bool true when the versions are equal.

operator >(PdfVersion, PdfVersion)

PdfVersion.cs

Indicates whether a version is greater than another one.

public static bool operator >(PdfVersion left, PdfVersion right)

Parameters

left PdfVersion
The first version.
right PdfVersion
The second version.

Returns

bool true when left is greater.

operator >=(PdfVersion, PdfVersion)

PdfVersion.cs

Indicates whether a version is greater than or equal to another one.

public static bool operator >=(PdfVersion left, PdfVersion right)

Parameters

left PdfVersion
The first version.
right PdfVersion
The second version.

Returns

bool true when left is greater or equal.

operator !=(PdfVersion, PdfVersion)

PdfVersion.cs

Indicates whether two versions are different.

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

Parameters

left PdfVersion
The first version.
right PdfVersion
The second version.

Returns

bool true when the versions are different.

operator <(PdfVersion, PdfVersion)

PdfVersion.cs

Indicates whether a version is lower than another one.

public static bool operator <(PdfVersion left, PdfVersion right)

Parameters

left PdfVersion
The first version.
right PdfVersion
The second version.

Returns

bool true when left is lower.

operator <=(PdfVersion, PdfVersion)

PdfVersion.cs

Indicates whether a version is lower than or equal to another one.

public static bool operator <=(PdfVersion left, PdfVersion right)

Parameters

left PdfVersion
The first version.
right PdfVersion
The second version.

Returns

bool true when left is lower or equal.