Class PdfNumber
java.lang.Object
com.itextpdf.kernel.pdf.PdfObject
com.itextpdf.kernel.pdf.PdfPrimitiveObject
com.itextpdf.kernel.pdf.PdfNumber
A
PdfNumber-class is the PDF-equivalent of a Double-object.
PDF provides two types of numeric objects: integer and real. Integer objects represent mathematical integers. Real objects represent mathematical real numbers. The range and precision of numbers may be limited by the internal representations used in the computer on which the PDF processor is running. An integer shall be written as one or more decimal digits optionally preceded by a sign. The value shall be interpreted as a signed decimal integer and shall be converted to an integer object. A real value shall be written as one or more decimal digits with an optional sign and a leading, trailing, or embedded period (decimal point).
-
Field Summary
FieldsFields inherited from class PdfPrimitiveObject
content, directOnlyFields inherited from class PdfObject
ARRAY, BOOLEAN, DICTIONARY, FLUSHED, FORBID_RELEASE, FREE, INDIRECT_REFERENCE, indirectReference, LITERAL, MODIFIED, MUST_BE_FLUSHED, MUST_BE_INDIRECT, NAME, NULL, NUMBER, ORIGINAL_OBJECT_STREAM, READ_ONLY, READING, STREAM, STRING, UNENCRYPTED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcopyContent(PdfObject from, PdfDocument document, ICopyFilter copyFilter) Copies object content from object 'from'.voidDecrements current value.doubleReturns double value of current instance ofPdfNumber.booleanfloatReturns value and converts it to float.protected voidprotected voidbytegetType()Gets object type.doublegetValue()Returns value of current instance ofPdfNumber.booleanChecks if string representation of the value contains decimal point.inthashCode()voidIncrements current value.intintValue()Returns value and converts it to an int.protected booleanlongReturns value and converts it to long.protected PdfObjectCreates new instance of object.voidsetValue(double value) Sets value.voidsetValue(int value) Sets value and convert it to double.toString()Methods inherited from class PdfPrimitiveObject
compareContent, getInternalContent, hasContent, makeIndirect, setIndirectReferenceMethods inherited from class PdfObject
checkState, clearState, clone, clone, containsIndirectReference, copyContent, copyTo, copyTo, copyTo, copyTo, equalContent, flush, flush, getIndirectReference, isArray, isBoolean, isDictionary, isFlushed, isIndirect, isIndirectReference, isLiteral, isModified, isName, isNull, isNumber, isReleaseForbidden, isStream, isString, makeIndirect, processCopying, processCopying, release, setModified, setState
-
Field Details
-
value
private double value -
isDouble
private boolean isDouble
-
-
Constructor Details
-
PdfNumber
public PdfNumber(double value) Creates an instance ofPdfNumberand sets value.- Parameters:
value- double value to set
-
PdfNumber
public PdfNumber(int value) Creates an instance ofPdfNumberand sets value.- Parameters:
value- int value to set
-
PdfNumber
public PdfNumber(byte[] content) Creates an instance ofPdfNumberwith provided content.- Parameters:
content- byte array content to set
-
PdfNumber
private PdfNumber()
-
-
Method Details
-
getType
-
getValue
-
doubleValue
-
floatValue
public float floatValue()Returns value and converts it to float.- Returns:
- value converted to float
-
longValue
public long longValue()Returns value and converts it to long.- Returns:
- value converted to long
-
intValue
public int intValue()Returns value and converts it to an int. If value surpassesInteger.MAX_VALUE,Integer.MAX_VALUEwould be return.- Returns:
- value converted to int
-
setValue
public void setValue(int value) Sets value and convert it to double.- Parameters:
value- to set
-
setValue
public void setValue(double value) Sets value.- Parameters:
value- to set
-
increment
public void increment()Increments current value. -
decrement
public void decrement()Decrements current value. -
toString
-
equals
-
hasDecimalPoint
public boolean hasDecimalPoint()Checks if string representation of the value contains decimal point.- Returns:
- true if contains so the number must be real not integer
-
hashCode
-
newInstance
Description copied from class:PdfObjectCreates new instance of object.- Specified by:
newInstancein classPdfObject- Returns:
- new instance of object.
-
isDoubleNumber
protected boolean isDoubleNumber() -
generateContent
protected void generateContent()- Specified by:
generateContentin classPdfPrimitiveObject
-
generateValue
protected void generateValue() -
copyContent
Description copied from class:PdfObjectCopies object content from object 'from'.- Overrides:
copyContentin classPdfPrimitiveObject- Parameters:
from- object to copy content from.document- document to copy object to.copyFilter-ICopyFiltera filter that will apply on dictionaries and array UseNullCopyFilterfor no filtering
-