exportSettings()

Exports the current viewer settings to a JSON file. This method has overloaded versions that provide flexibility in how the settings are exported and how the results are delivered.

exportSettings()

Exports the viewer settings to a downloadable JSON file. This is the simplest form that uses default behavior. The exported settings include client parameters, current configuration, viewer information.

Sample syntax

viewONE.exportSettings();

exportSettings(boolean downloadFile)

Exports the viewer settings with control over whether to download the file as JSON. The exported settings include client parameters, current configuration, viewer information.

downloadFile (boolean) If true, exports as a downloadable JSON file. If false, the settings are still collected as string but not downloaded (useful when used with event handlers or for internal processing).

Sample syntax

// Export and download the settings file
viewONE.exportSettings(true);

// Export without downloading (settings are collected but not downloaded)
viewONE.exportSettings(false);

exportSettings(boolean downloadFile, JavaScriptObject callback)

Exports the viewer settings with full control over download behavior and callback notification. This method collects all current viewer settings including processed parameters, current configuration, viewer information and server parameters (only if the server parameter exportServerParams is set to true) . The callback provides programmatic access to the exported settings JSON.

  • downloadFile - If true, exports as a downloadable JSON file. If false, returns via callback only without triggering a download.

  • callback - Callback object to be notified when export completes or fails. The callback must implement the IDCallback interface with onSuccess(String) and onError(String) methods.

Callback Interface

The callback object must implement:

  • onSuccess(String settingsJson) is called when settings are successfully exported. The settingsJson parameter contains the complete exported settings in JSON format, including server parameters.

  • onError(String errorMessage) is called when export fails. The errorMessage parameter contains the error description.

Sample syntax

// Define callback object
var settingsCallback = {
    onSuccess: function(settingsJson)
{         console.log("Settings exported successfully");
          console.log("Settings JSON:", settingsJson);
                  // Parse and process the settings
         var settings = JSON.parse(settingsJson);     }
,
    onError: function(errorMessage)
{         console.error("Failed to export settings:", errorMessage);         // Handle the error     }

};

// Export with callback and download
viewONE.exportSettings(true, settingsCallback);

// Export with callback only (no download) - useful for programmatic access
viewONE.exportSettings(false, settingsCallback);