Download images/documents from the web

We can call our built-in HTTP download method to download the image(s) or document(s) asynchronously to DcsBuffer.

Format Method
PNG, JPEG, PDF downloadAsync()

DcsHttpDownloadConfig config=new DcsHttpDownloadConfig();

        config.url="<your download url>"; // Specifies the url of the image you want to download. Please change it to your own.
        dcsView.getIO().downloadAsync(config, DcsVideoView.DME_IMAGE, new IDownload() {
            @Override
            public boolean onDownloadProgress(int progress) {
                Log.d("download progress", "" +progress);
                return true;
            }

            @Override
            public void onDownloadSuccess() {
                Log.d("download", "succeed ");
            }

            @Override
            public void onDownloadFailure(DcsException e) {
                Log.d("upload error", "" + e.getMessage());
            }
        });

With the above code, the image will be downloaded into DcsBuffer as dcsImage.

This is especially useful when you want to review an image/a document created and uploaded by Dynamsoft Camera SDK.

Is this page helpful?

Leave a Reply

Your email address will not be published.