Display document without downloading

17 Feb 20221 minute to read

The PDF Viewer server library allows you to display the downloaded PDF document in the PDF Viewer control without downloading a document in the local machine using the load method.

The following steps are used to display the downloaded without downloading in the local machine.

Step 1: Follow the steps provided in the link to create a simple PDF Viewer sample.

Step 2: Use the following code snippet to Display document without downloading.

<button onclick="downloadDocument()">downloadDocument</button>

    function downloadDocument() {
        var viewer = document.getElementById('pdfviewer').ej2_instances[0];
        viewer.saveAsBlob().then(function (value) {
            var data = value;
            var reader = new FileReader();
            reader.onload = () => {
                var base64data = reader.result;
                viewer.load(base64data, null);

Download the sample how to display document without downloading