Skip to content

PdfNumber class

View as Markdown

Namespace: PdfNetStack.Objects
Assembly: PdfNetStack.dll
Package: PdfNetStack

A PDF integer or real. The value is kept as canonical ASCII text so that reals read from a file survive a round trip exactly, with no floating point conversion involved.

public sealed class PdfNumber : PdfObject

Inheritance

object ← PdfObject ← PdfNumber

The integer value. Valid only when IsInteger is true.

public long IntegerValue { get; }

long

True for integers, false for reals.

public bool IsInteger { get; }

bool

Creates a real, rounded to 6 decimal places and written without an exponent, as PDF requires. Whole values become integers.

public static PdfNumber FromDouble(double value)

value double

PdfNumber

ArgumentOutOfRangeException

value is NaN or infinite.

Creates an integer.

public static PdfNumber FromInteger(long value)

value long

PdfNumber

The value as a double. Exact for integers up to 2^53.

public double ToDouble()

double

The number as written in the file.

public override string ToString()

string