The steps listed below describe how to create an ASP.NET Core Web Application that uses DsPdfViewer to view PDF Files.
DsPdfViewer's open method supports loading PDF files from local path, same domain and another domain URL sources.
To open a local PDF file in DsPdfViewer, click the Open button ( ) present on the top-left corner of the viewer. It opens the Open dialog to choose a PDF file.
You can also open a PDF file using code. Refer to the following example code to open a PDF file from local.
Copy Code
|
|
---|---|
// Local path. viewer.open("assets/pdf/newsletter.pdf"); |
To open a PDF file from the same domain URL in DsPdfViewer, pass the URL string in the open method.
Refer to the following example code to open a PDF file from same domain URL.
Copy Code
|
|
---|---|
// URL path. viewer.open("https://developer.mescius.com/documents-api-pdf/docs/newsletter.pdf"); |
To open a PDF file from another domain URL in DsPdfViewer, pass the URL string with CorsProxy in the open method.
Refer to the following example code to open a PDF file from another domain URL.
Copy Code
|
|
---|---|
// Another domain URL path. viewer.open("https://localhost:7288/api/pdf-viewer/CorsProxy?url=https://developer.mescius.com/documents-api-pdf/docs/newsletter.pdf"); |