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 Description rectStringstring Rect in string format. pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page. separatorstring Separator used for coordinates. Defaults to ',' if not defined. Returns:
New Rect with the x and y coordinates.- Type
- Core.Math.Rect
-
<static> deserializeMeasure(measureDictionary)
-
Deserializes the measure XML element into a measure object.
Parameters:
Name Type Description measureDictionaryElement Measure element. Returns:
Object with measure information.- Type
- object
-
<static> deserializePoint(pointString, pageMatrix, coordinateSeparator)
-
Deserializes a point string into a point object.
Parameters:
Name Type Description pointStringstring Point in string format. pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page. coordinateSeparatorstring Separator used for coordinates. Defaults to ',' if not defined. Returns:
New Point with with an x and y coordinate.- Type
- Core.Math.Point
-
<static> deserializePointArray(pointArrayText, pageMatrix, coordinateSeparator, pointSeparator)
-
Deserializes a list of points in string format into a point array.
Parameters:
Name Type Description pointArrayTextstring Array of points in string (delimited by pointSeparator). pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page. coordinateSeparatorstring Separator used for coordinates. Defaults to ',' if not defined. pointSeparatorstring Separator used for points. Defaults to ';' if not defined. Returns:
Array of Points.- Type
- Array.<Core.Math.Point>
-
<static> deserializeRect(rectString, pageMatrix, separator)
-
Deserializes a rect string into a rect object.
Parameters:
Name Type Description rectStringstring Rect in string format. Default value '0,0,0,0'. pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page. separatorstring Separator used for coordinates. Defaults to ',' if not defined. Returns:
New Rect with the x and y 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 information in object format.- Type
- object
Example
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 object into a measure XML element.
Parameters:
Name Type Description measureDictionaryobject Object with measure information. Properties
Name Type Description areaarray Area axisarray Axis distancearray Distance scalestring Scale Returns:
Return element.- Type
- Element
-
<static> serializePoint(point, pageMatrix, coordinateSeparator)
-
Serializes the point into a string suitable for an XFDF file.
Parameters:
Name Type Description pointCore.Math.Point Point with an x and y coordinate. pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page. coordinateSeparatorstring Separator used for coordinates. Defaults to ',' if not defined. Returns:
Point in string format.- Type
- string
-
<static> serializePointArray(pointArray, pageMatrix, coordinateSeparator, pointSeparator)
-
Seriarlize the array of points into a string suitable for an XFDF file.
Parameters:
Name Type Description pointArrayArray.<Core.Math.Point> Array of points. pageMatrixCore.Math.Matrix Object representing the transformation matrix for the page. coordinateSeparatorstring Separator used for coordinates. Defaults to ',' if not defined. pointSeparatorstring Separator used for points. Defaults to ';' if not defined. 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 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> 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