VintaSoft Imaging .NET SDK 14.0: Documentation for Web developer
Vintasoft.Imaging.UI Namespace / WebDocumentViewerBaseJS type / exportAndDownloadFile Methods / exportAndDownloadFile(Vintasoft.Imaging.WebExportFileSettingsJS,function,function) Property
Syntax Exceptions Example BrowserCompatibility SeeAlso
In This Topic
    exportAndDownloadFile(Vintasoft.Imaging.WebExportFileSettingsJS,function,function) Method
    In This Topic
    Exports images (with annotations), which are loaded in web image viewer, to a file and downloads the file.
    Syntax
    var instance = new Vintasoft.Imaging.UI.WebDocumentViewerBaseJS(settings);
    
    var value; // Type: any
    
    // Parameters
    var exportFileSettings; // Type: WebExportFileSettingsJS
    var successFunc; // Type: function
    var errorFunc; // Type: function
    
    value = instance.exportAndDownloadFile(exportFileSettings, successFunc, errorFunc);
    
    
    function exportAndDownloadFile(
    exportFileSettings
    An instance of WebExportFileSettingsJS clas that defines the export file settings.
    : WebExportFileSettingsJS,
    successFunc
    Function that will be executed if request is executed successfully.
    Here is function prototype "function __success(data)".
    The data parameter has the following properties:
    • fileId (string): A file identifier.
    : Function,
    errorFunc
    Function that will be executed if request is failed.
    Here is function prototype "function __error(data)".
    The data parameter can be:
    1. An object with following properties:
      • errorMessage (string): Error message.
      • blocked (boolean): Indicates that the requested action is blocked by another request.
      if exception is catched inside web service.
    2. Otherwise, jqXHR object.
    : Function
    ) : any;

    Parameters

    exportFileSettings
    An instance of WebExportFileSettingsJS clas that defines the export file settings.
    successFunc
    Function that will be executed if request is executed successfully.
    Here is function prototype "function __success(data)".
    The data parameter has the following properties:
    • fileId (string): A file identifier.
    errorFunc
    Function that will be executed if request is failed.
    Here is function prototype "function __error(data)".
    The data parameter can be:
    1. An object with following properties:
      • errorMessage (string): Error message.
      • blocked (boolean): Indicates that the requested action is blocked by another request.
      if exception is catched inside web service.
    2. Otherwise, jqXHR object.
    Exceptions
    ExceptionDescription
    Thrown if argument has wrong type.
    Example

    ThisJavaScriptcodeshowshowtoexportimageswithannotationstoafileanddownloadthefile:
                      // create the export file settings
                      var exportFileSettings = new Vintasoft.Imaging.WebExportFileSettingsJS();
                      // specify the indexes of images, which must be saved
                      exportFileSettings.set_ImageIndexes([ 0, 2, 0, 1 ]);
                      // specify the name of the file, where images must be saved
                      exportFileSettings.set_FileId("document.pdf");
                      // specify that annotations must be saved with images
                      exportFileSettings.set_SaveAnnotations(true);
                      
                      // export images to a file and download the file
                      docViewer1.exportAndDownloadFile(
                          exportFileSettings,
                          function(data) {
                              console.log("File changes are saved successfully.");
                          },
                          function(data) {
                              console.log("File changes are not saved.");
                          }
                      );
    

    Browser Compatibility
    56+
    45+
    11
    See Also