Static Functions

12 Sep 202517 minutes to read

Root static functions of Pdf Component

_appendChar

Convert character code to string.

Parameter Type Description
value number Input value.

Returns string

_arabicToLetter

Convert arabic numbers to alphabet.

Parameter Type Description
arabic number Input value.

Returns string

_arabicToRoman

Convert arabic numbers to roman style.

Parameter Type Description
intArabic number Input value.

Returns string

_checkInkPoints

Gets the boolean if two arrays are equal.

Parameter Type Description
inkPointsCollection Array Ink points collection.
previousCollection Array Previous collection.

Returns boolean

_checkRotation

Gets the page rotation.

Parameter Type Description
page PdfPage Page.
height number Height.
left number Left.

Returns number

_checkType

Checks the type of the image using header bytes.

Parameter Type Description
imageData Uint8Array image data.
header number[] header bytes.

Returns boolean

_compressStream

Compresses the content of a PDFBaseStream

Parameter Type Description
stream _PdfBaseStream Base stream to compress.
isExport boolean Denotes compress the stream as a hex-encoded string.

Returns string

_convertNumber

Convert number respect to ordered list number style.

Parameter Type Description
intArabic number Input value.
numberStyle PdfNumberStyle Number style.

Returns string

_convertToHex

Converts a single hexadecimal character to its numeric value.

Parameter Type Description
char string A single character string representing a hexadecimal digit (‘0’-‘9’, ‘A’-‘F’, ‘a’-‘f’).

Returns number

_copyRange

Copy values from one array to another.

Parameter Type Description
target number[] destination array.
at number target index.
source number[] source array.
start number start index.
end number end index.

Returns void

_createFontStream

Creates a font stream for the given font and form, extracting the font data from font descriptors.

Parameter Type Description
form PdfForm The target PDF form containing cross-references to the font data.
font _PdfDictionary The dictionary that defines the font, containing references to font descriptors.

Returns Uint8Array

_decodeFontFamily

Decodes a font family string that contains hexadecimal encoded characters.

Parameter Type Description
fontFamily string The font family string to be decoded. May contain hex encoded characters prefixed by ‘#’.

Returns string

_decodeText

Decode text.

Parameter Type Description
text string Text to decode.
isColorSpace boolean Color space or not
isPassword boolean Password or not

Returns string

_defaultToString

Gets the default string.

Parameter Type Description
item string | number | string[] | number[] | Object | Object[] | boolean Input string.

Returns string

_defineProperty

Defines a property on an object with specific attributes.

Returns any

_getDecoder

Gets the image decoder.

Parameter Type Description
imageData Uint8Array image data.

Returns _ImageDecoder

_getFontFromDescriptor

Gets the font data.

Parameter Type Description
dictionary _PdfDictionary font dictionary.

Returns Uint8Array

_getFontStyle

Gets the font style.

Parameter Type Description
fontFamilyString string Font family string.

Returns PdfFontStyle

_getPageIndex

Gets the page index.

Parameter Type Description
loadedDocument PdfDocument Loaded document.
pageDictionary _PdfDictionary Page dictionary.

Returns number

_getSize

Number of bytes required to save the number.

Parameter Type Description
input number number.

Returns number

_hasUnicodeCharacters

Checks if the given string contains any Unicode (non-ASCII) characters.

Parameter Type Description
value string The string to check for Unicode characters.

Returns boolean

_isNullOrUndefined

Check whether the value is null or undefined.

Parameter Type Description
value any Input value.

Returns boolean

_isRightToLeftCharacters

Check whether the input string contains any right-to-left (RTL) characters.

Parameter Type Description
input string The input string.

Returns boolean

_isUnicode

Determines whether a given string contains Unicode characters.

Parameter Type Description
value string The string to be checked.

Returns boolean

_mapFont

Map the font.

Parameter Type Description
name string Font name.
size number Font size.
style PdfFontStyle Font style.
annotation PdfAnnotation | PdfField Annotation or Field.
fontDictionary (optional) _PdfDictionary Font dictionary.

Returns PdfFont

_mapRubberStampIcon

Map rubber stamp icon.

Parameter Type Description
iconString string String value.

Returns PdfRubberStampAnnotationIcon

_obtainFontDetails

Gets the form field font.

Parameter Type Description
form PdfForm form.
widget PdfWidgetAnnotation widget annotation.
field PdfField field.

Returns PdfFont

_readUnsignedInteger16

Reads a 16-bit unsigned integer from the specified offset in the given data array.

Parameter Type Description
data Uint8Array The data array containing the bytes.
offset number The position in the data array to start reading.

Returns number

_setRotateAngle

Sets the rotation angle for a PDF annotation if necessary.
It ensures that the rotation is within the normalized range [0, 360) degrees.

Parameter Type Description
rotateAngle number The rotation angle to be set for the annotation. Negative values are normalized.
annot PdfAnnotation The PDF annotation object which may have its rotation angle modified.

Returns void

_stringToBigEndianBytes

Convert the string to big endian bytes.

Parameter Type Description
input string string.

Returns number[]

_toSigned16

Gets the signed 16 bit value.

Parameter Type Description
value number input value.

Returns number

_toSigned32

Gets the signed 32 bit value.

Parameter Type Description
value number input value.

Returns number

_toUnsigned

Gets the unsigned value.

Parameter Type Description
value number input value.
bits number bits to process.

Returns number

_tryParseFontStream

Gets the font stream.

Parameter Type Description
widgetDictionary _PdfDictionary Widget dictionary.
crossReference _PdfCrossReference Cross reference.
annotation PdfAnnotation | PdfField Annotation.
fontResourceName (optional) string Font resource name.

Returns Uint8Array

_updateBounds

Update the annotation bounds.

Parameter Type Description
annotation PdfAnnotation annotation.
bounds (optional) number[] annotation bounds.

Returns number[]

_updatePageCount

Updates the page count value in the dictionary

Parameter Type Description
dictionary _PdfDictionary Dictionary to update page count.
valueToIncrement number Page count.

Returns void

_updatePageSettings

Updates the page settings in the dictionary

Parameter Type Description
dictionary _PdfDictionary Dictionary to update page settings.
settings PdfPageSettings PDF page settings.

Returns void