# Class: XFDFUtils

## Core.Annotations. XFDFUtils

#### 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
  --- | --- | ---
  `rectString` | string | Rect in string format.
  `pageMatrix` | Core.Math.Matrix | Object representing the transformation matrix for the page.
  `separator` | string | 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
  --- | --- | ---
  `measureDictionary` | Element | 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
  --- | --- | ---
  `pointString` | string | Point in string format.
  `pageMatrix` | Core.Math.Matrix | Object representing the transformation matrix for the page.
  `coordinateSeparator` | string | 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
  --- | --- | ---
  `pointArrayText` | string | Array of points in string (delimited by pointSeparator).
  `pageMatrix` | Core.Math.Matrix | Object representing the transformation matrix for the page.
  `coordinateSeparator` | string | Separator used for coordinates. Defaults to ',' if not defined.
  `pointSeparator` | string | 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
  --- | --- | ---
  `rectString` | string | Rect in string format. Default value '0,0,0,0'.
  `pageMatrix` | Core.Math.Matrix | Object representing the transformation matrix for the page.
  `separator` | string | 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
  --- | --- | ---
  `da` | string | 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
  --- | --- | ---
  `rect` | Core.Math.Rect | Rect with the x and y coordinates.
  `pageMatrix` | Core.Math.Matrix | Object representing the transformation matrix for the page.
  `separator` | string | 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
  --- | --- | ---
  `measureDictionary` | object | Object with measure information. ###### Properties
  Name | Type | Description
  --- | --- | ---
  `area` | array | Area
  `axis` | array | Axis
  `distance` | array | Distance
  `scale` | string | 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
  --- | --- | ---
  `point` | Core.Math.Point | Point with an x and y coordinate.
  `pageMatrix` | Core.Math.Matrix | Object representing the transformation matrix for the page.
  `coordinateSeparator` | string | 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
  --- | --- | ---
  `pointArray` | Array.<Core.Math.Point> | Array of points.
  `pageMatrix` | Core.Math.Matrix | Object representing the transformation matrix for the page.
  `coordinateSeparator` | string | Separator used for coordinates. Defaults to ',' if not defined.
  `pointSeparator` | string | 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
  --- | --- | ---
  `rect` | Core.Math.Rect | Rect with the x and y coordinates.
  `pageMatrix` | Core.Math.Matrix | Object representing the transformation matrix for the page.
  `separator` | string | 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
  --- | --- | ---
  `date` | Date | Date object.

  ##### Returns:

  Date in string format.
  Type
    string

#### Search results