PdfVersion Struct
A version of the PDF format, such as 1.7 or 2.0.
public readonly struct PdfVersion : IComparable<PdfVersion>, IEquatable<PdfVersion>Constructors
| Name | Description |
|---|---|
| PdfVersion(int, int) | Initializes a new instance of the PdfVersion struct. |
PdfVersion(int, int)
PdfVersion.csInitializes a new instance of the PdfVersion struct.
Properties
| Name | Description |
|---|---|
| Major | Gets the major version. |
| Minor | Gets the minor version. |
| Pdf14 | Gets PDF 1.4. |
| Pdf15 | Gets PDF 1.5, the first version with object streams and cross-reference streams. |
| Pdf16 | Gets PDF 1.6. |
| Pdf17 | Gets PDF 1.7 (ISO 32000-1). |
| Pdf20 | Gets PDF 2.0 (ISO 32000-2). |
Major
PdfVersion.csMinor
PdfVersion.csPdf14
PdfVersion.csPdf15
PdfVersion.csGets PDF 1.5, the first version with object streams and cross-reference streams.
public static PdfVersion Pdf15 { get; }Property value
Pdf16
PdfVersion.csPdf17
PdfVersion.csPdf20
PdfVersion.csMethods
| Name | Description |
|---|---|
| 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.csCompares 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
otherPdfVersion- 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:
| Value | Meaning |
|---|---|
| Less than zero | This instance precedes other in the sort order. |
| Zero | This instance occurs in the same position in the sort order as other. |
| Greater than zero | This instance follows other in the sort order. |
Equals overloads
Equals(PdfVersion)
PdfVersion.csIndicates whether the current object is equal to another object of the same type.
public bool Equals(PdfVersion other)Parameters
otherPdfVersion- 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.csGetHashCode()
PdfVersion.csMax(PdfVersion, PdfVersion)
PdfVersion.csReturns the greater of two versions.
public static PdfVersion Max(PdfVersion left, PdfVersion right)Parameters
leftPdfVersion- The first version.
rightPdfVersion- The second version.
Returns
PdfVersion The greater version.
ToString()
PdfVersion.csTryParse(string?, PdfVersion)
PdfVersion.csParses a version written as in a PDF header, such as 1.7.
public static bool TryParse(string? value, out PdfVersion version)Parameters
valuestring?- The text.
versionPdfVersion- The version.
Returns
bool true when the text is a version.
Operators
| Name | Description |
|---|---|
| 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.csIndicates whether two versions are equal.
public static bool operator ==(PdfVersion left, PdfVersion right)Parameters
leftPdfVersion- The first version.
rightPdfVersion- The second version.
Returns
bool true when the versions are equal.
operator >(PdfVersion, PdfVersion)
PdfVersion.csIndicates whether a version is greater than another one.
public static bool operator >(PdfVersion left, PdfVersion right)Parameters
leftPdfVersion- The first version.
rightPdfVersion- The second version.
Returns
bool true when left is greater.
operator >=(PdfVersion, PdfVersion)
PdfVersion.csIndicates whether a version is greater than or equal to another one.
public static bool operator >=(PdfVersion left, PdfVersion right)Parameters
leftPdfVersion- The first version.
rightPdfVersion- The second version.
Returns
bool true when left is greater or equal.
operator !=(PdfVersion, PdfVersion)
PdfVersion.csIndicates whether two versions are different.
public static bool operator !=(PdfVersion left, PdfVersion right)Parameters
leftPdfVersion- The first version.
rightPdfVersion- The second version.
Returns
bool true when the versions are different.
operator <(PdfVersion, PdfVersion)
PdfVersion.csIndicates whether a version is lower than another one.
public static bool operator <(PdfVersion left, PdfVersion right)Parameters
leftPdfVersion- The first version.
rightPdfVersion- The second version.
Returns
bool true when left is lower.
operator <=(PdfVersion, PdfVersion)
PdfVersion.csIndicates whether a version is lower than or equal to another one.
public static bool operator <=(PdfVersion left, PdfVersion right)Parameters
leftPdfVersion- The first version.
rightPdfVersion- The second version.
Returns
bool true when left is lower or equal.