new XFDFUtils()
The namespace for utility functions for XFDF serialization and deserialization.
Methods
-
<static> deserializeFringeRect(rectString, pageMatrix [, separator])
-
Deserializes a fringe rect string into a rect object
Parameters:
Name Type Argument Default Description rectStringstring Rect in string format pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page separatorstring <optional>
',' Separator used for coordinates Returns:
New Rect with x1, y1, x2, y2 coordinates- Type
- Core.Math.Rect
-
<static> deserializeMeasure(measureDictionary)
-
Deserializes the measure XML element into a measure dictionary
Parameters:
Name Type Description measureDictionaryElement Measure element Returns:
Measure dictionary -
<static> deserializePoint(pointString, pageMatrix [, coordinateSeparator])
-
Deserializes a point string into a point object
Parameters:
Name Type Argument Default Description pointStringstring Point in string format pageMatrixCore.Math.Matrix Transformation matrix for the page coordinateSeparatorstring <optional>
',' Separator used for coordinates Returns:
New Point with an x and y coordinate, or null if pointString is not a string or has invalid format- Type
- Core.Math.Point | null
-
<static> deserializePointArray(pointArrayText, pageMatrix [, coordinateSeparator] [, pointSeparator])
-
Deserializes a list of points in string format into a point array.
Parameters:
Name Type Argument Default Description pointArrayTextstring Array of points in string (delimited by pointSeparator) pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page coordinateSeparatorstring <optional>
',' Separator used for coordinates pointSeparatorstring <optional>
';' Separator used for points Returns:
Array of Points- Type
- Array.<Core.Math.Point>
-
<static> deserializeRect(pageMatrix [, rectString] [, separator])
-
Deserializes a rect string into a rect object
Parameters:
Name Type Argument Default Description pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page rectStringstring <optional>
'0,0,0,0' Rect in string format separatorstring <optional>
',' Separator used for coordinates Returns:
New Rect with x1, y1, x2, y2 coordinates- Type
- Core.Math.Rect
-
<static> parseDefaultAppearance(da)
-
Parses a default appearance string from an XFDF file and returns an object representing the appearance
Parameters:
Name Type Description dastring Appearance information in string format Returns:
Appearance informationExample
const data = "0 0 0 rg /Helvetica 40 Tf"; const response = Annotations.XFDFUtils.parseDefaultAppearance(data); Output: { color: "#000000", font: { name: "Arial", rawName: "Helvetica", size: "40pt", }, str: "0 0 0 rg /Helvetica 40 Tf", } -
<static> serializeFringeRect(rect, pageMatrix, separator)
-
Serializes a fringe rect object into a string suitable for an XFDF file
Parameters:
Name Type Description rectCore.Math.Rect Rect with the x and y coordinates pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page separatorstring Separator used for coordinates. Defaults to ',' if not defined Returns:
Rect in string format- Type
- string
-
<static> serializeMeasure(measureDictionary)
-
Serializes the measure dictionary into a measure XML element
Parameters:
Name Type Description measureDictionaryCore.Annotations.XFDFUtils.MeasureDictionary Measure dictionary Returns:
Measure XML element- Type
- Element
-
<static> serializePoint(point, pageMatrix [, coordinateSeparator])
-
Serializes the point into a string suitable for an XFDF file
Parameters:
Name Type Argument Default Description pointCore.Math.Point Point with an x and y coordinate pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page coordinateSeparatorstring <optional>
',' Separator used for coordinates Returns:
Point in string format, or null if the point parameter is not a Point instance- Type
- string | null
-
<static> serializePointArray(pointArray, pageMatrix [, coordinateSeparator] [, pointSeparator])
-
Serialize the array of points into a string suitable for an XFDF file
Parameters:
Name Type Argument Default Description pointArrayArray.<Core.Math.Point> Array of points pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page coordinateSeparatorstring <optional>
',' Separator used for coordinates pointSeparatorstring <optional>
';' Separator used for points Returns:
Stringified array of points- Type
- string
-
<static> serializeRect(rect, pageMatrix [, separator])
-
Serializes a rect object into a string suitable for an XFDF file
Parameters:
Name Type Argument Default Description rectCore.Math.Rect Rect with x and y coordinates pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page separatorstring <optional>
',' Separator used for coordinates Returns:
Rect in string format- Type
- string
-
<static> toXMLDate(date)
-
Convert a JavaScript date object into a string date that can be used in XFDF
Parameters:
Name Type Description dateDate Date object. Returns:
Date in string format.- Type
- string
Type Definitions
-
Appearance
-
Default appearance information parsed from a string
Type:
- Object
Properties:
Name Type Argument Description colorstring <optional>
Hex RGB color e.g. #RRGGBB fontObject <optional>
Font details Properties
Name Type Description namestring Display font name rawNamestring Raw font name from the string sizestring Font size with unit (pt) strstring Original appearance string -
MeasureDictionary
-
Measurement dictionary containing arrays of number format entries
Type:
- Object
Properties:
Name Type Argument Description areaArray.<Core.Annotations.XFDFUtils.NumberFormat> <optional>
Area number formats axisArray.<Core.Annotations.XFDFUtils.NumberFormat> <optional>
Axis number formats distanceArray.<Core.Annotations.XFDFUtils.NumberFormat> <optional>
Distance number formats scalestring <optional>
Scale value -
NumberFormat
-
A number format entry used in measurement dictionaries
Type:
- Object
Properties:
Name Type Argument Description factornumber <optional>
Conversion factor unitstring <optional>
Unit name decimalSymbolstring <optional>
Decimal separator character thousandsSymbolstring <optional>
Thousands separator character displaystring <optional>
Display mode code precisionnumber <optional>
Number of decimal digits unitPrefixstring <optional>
Unit prefix string unitSuffixstring <optional>
Unit suffix string unitPositionstring <optional>
Position of unit relative to value