Converts the specified object into an instance of Java class:
com.docflex.api.util.Binary

Currently, this function works simply as a type cast operator, the same as it would be in Java:

(Binary) obj
If the specified object is already an instance of Binary class, the same object is returned; otherwise, the function returns null.

Some Data Source Models (e.g. XML DSM), allow certain elements and attributes to return values of binary type, which are objects of com.docflex.api.util.Binary Java class. This function allows using such values in templates.

For instance, you may use toBinary() function, when you want to insert in the generated documents the images dynamically provided by the data source (or a custom Java class).

In particular, you may define an Image Control as the following:

  1. Select "Image" tab in the control's properties dialog.
  2. Select "Dynamic Image" as image type. In "Expression for Binary Object" field, specify the expression that returns an image provided as a Binary object. For example:
    getValueByLPath("Item/Icon").toBinary()
    See Also:
    getValueByLPath(), getAttrValue(), GOMElement.value, callForName()