Download image(s) from the web

You can use the method httpDownload() or httpDownloadAsync() to download an image from the web server into Dynamsoft image viewer."", onHttpDownloadSuccess, onHttpDownloadFailure);

//Callback functions for httpDownloadAsync()
function onHttpDownloadSuccess (){ 

function onHttpDownloadFailure (errorCode, errorString, httpResponse){ 
    alert(errorString + httpResponse); 

This is especially useful when you want to review an image created and uploaded by Dynamsoft Camera SDK. Even when the image data is stored in the database, you can write an action page to pull the data from the database and get it downloaded.

NOTE: Same as mentioned earlier in the section Uploading image(s) to the web server, special configuration has to be made on the server to overcome browser security restrictions. When you try to download an image from a server with a different domain, subdomain, port, or protocol, you need to configure your server to allow such requests by adding one HTTP Response Header, namely:

Access-Control-Allow-Origin: *

Take IIS 7 for example, what you need to do is merge the following lines into the web.config file at the root of your application / site:

<?xml version="1.0" encoding="utf-8"?>

        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Methods" value="OPTIONS,POST,GET,PUT"/>
        <add name="Access-Control-Allow-Headers" value="x-requested-with"/>
        <add name="Access-Control-Allow-Credentials" value="true" />

If you don't have a web.config file already, just create a new file called "web.config" and add the snippet above.