VintaSoft Imaging .NET SDK 12.4: Documentation for Web developer
In This Topic
    Open images
    In This Topic
    SDK can open images from the following image and document file formats:


    Open image file stored on server

    SDK can open images, which are stored on server.

    Here is an example that shows how to clear image collection of web image viewer, load images from TIFF file, which is located on server, and add created images to the image collection:
    // identifier of multipage TIFF file, which is located on server
    var fileId = "multipage.tif";
    // get image collection of image viewer
    var images = imageViewer.get_Images();
    // clear image collection and add all images from TIFF file to the image collection
    images.openFile(fileId);
    
    


    Here is an example that shows how to load images from TIFF file, which is located on server, and add created images to the image collection of web image viewer:
    // File is opened successfully. This function is obligatory because without this function the image collection will be cleared.
    function __openFile_success(data) {
        // an array of WebImageJS objects, which represent images from opened TIFF file
        var newImages = data.images;
        // add images to the end of image collection
        images.addRange(newImages);
    }
    
    // identifier of multipage TIFF file, which is located on server
    var fileId = "multipage.tif";
    // get image collection of image viewer
    var images = imageViewer.get_Images();
    // add all images from multipage TIFF file to the end of image collection
    images.openFile(fileId, __openFile_success);
    
    


    Here is an example that shows how to clear image collection of web image viewer, load images from several image files, which are located on server, and add created images to the image collection:
    // array of file identifiers
    var filesIds = ["image.png", "multipage.tif", "multipage.pdf"];
    // get image collection of image viewer
    var images = imageViewer.get_Images();
    // clear image collection and add all images from image files to the image collection
    images.openFiles(filesIds);
    
    


    Here is an example that shows how to load images from several image files, which are located on server, and add created images to the image collection of web image viewer:
    // File is opened successfully. This function is obligatory because without this function the image collection will be cleared.
    function __openFile_success(data) {
        // an array of WebImageJS objects, which represent images from opened image files
        var newImages = data.images;
        // add images to the end of image collection
        images.addRange(newImages);
    }
    
    // array of file identifiers
    var filesIds = ["image.png", "multipage.tif", "multipage.pdf"];
    // get image collection of image viewer
    var images = imageViewer.get_Images();
    // add all images from image files to the end of image collection
    images.openFiles(filesIds, __openFile_success);
    
    


    Here is an example that shows how to create web image, which is associated with the first page of TIFF file, and add created image to the image collection of web image viewer:
    // identifier of multipage TIFF file, which is located on server
    var fileId = "multipage.tif";
    // create source of image file (with default image service)
    var imageSource = new Vintasoft.Shared.WebImageSourceJS(fileId);
    // create WebImageJS object, which is associated with the first page of multipage TIFF file
    var image = new Vintasoft.Shared.WebImageJS(imageSource, 0);
    
    // get image collection of image viewer
    var images = imageViewer.get_Images();
    // add new image to the image collection of image viewer
    // Important: Image collection must not contain identical image, i.e. images with the same source identifier and page index.
    images.add(image);
    
    



    Open image file stored in database

    SDK can open images, which are stored in database or any other data storage. More info please read in the article: How to view images from database.