Articles in this section

How to load a PDF document from URL into PDF Viewer from client-side

PDF viewer do not have support to load the PDF document from the URL directly. However, you can load the PDF document by converting the URL to base64 string using the client-side load() API in the sample level.

Refer to the following code snippet. 

          var staticUrl = 'http://www.syncfusion.com/downloads/support/directtrac/general/pd/HTTP_Succinctly-1719682472';
            var xhr = new XMLHttpRequest();
            xhr.open('GET', staticUrl, true);
            xhr.responseType = 'blob';
            xhr.onload = function(e) {
                if (this.status == 200) {
                    var myBlob = this.response;
                    var reader = new window.FileReader();
                  //read the blob data
                    reader.readAsDataURL(myBlob);
                    reader.onloadend = function () {
                        base64data = reader.result; 
                        var pdfviewerObject = $('#PdfViewer').data('ejPdfViewer');
                      //load the base64 string
                        pdfviewerObject.load(base64data);
                    }
                }
            };
            xhr.send();

 

Sample link:  

https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample2003119113

 

Executing the previously given sample will provide the output as follows.

 

 

You can find the PDF Viewer’s other options like adding Toolbar Customization, TextMarkup annotation, and Handwritten Signature features here with code examples.

Refer here to explore the rich set of PDF Viewer features. 

An online demo link to view PDF documents using Syncfusion PDF Viewer.


See Also: 

https://www.syncfusion.com/jquery/aspnet-web-forms-ui-controls/pdf-viewer

https://www.syncfusion.com/jquery-ui-widgets/pdf-viewer

https://www.syncfusion.com/uwp-ui-controls/pdf-viewer

https://www.syncfusion.com/winforms-ui-controls/pdf-viewer

https://www.syncfusion.com/wpf-controls/pdf-viewer


Conclusion

I hope you enjoyed learning about how to load a PDF document from URL into PDF Viewer from client-side.

You can refer to our ASP.NET MVC PDF Viewer feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET MVC PDF Viewer example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied