How to implement Document Viewer using Asp.net C#?
Loading
How to implement Document Viewer using Asp.net C#?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Marvin ReidPosted Aug 18, 2023, 5:58 PM
You can create a Document Viewer application in ASP.NET by using the DocumentViewer object. Here is a tutorial and sample code that highlights how:
https://www.leadtools.com/help/sdk/tutorials/html5-asp-dotnet-typescript-display-files-in-the-document-viewer.html
Tahir AnsariPosted Aug 16, 2023, 9:37 AM
Hi SUJAY ANAND,
Please install GroupDocs.Viewer package.
Build solution and run.
Accept the answer if it is helpful.
Sujay AnandPosted Aug 16, 2023, 5:37 AM
Can you share the source code?
Abhishek YadavPosted Aug 16, 2023, 5:00 AM
To implement a Document Viewer using ASP.NET C#, you can follow the steps below:
Create a web project in Visual Studio by selecting ASP.NET Web Application (.NET Framework) template.
Add necessary NuGet packages:
Select Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
Search for "SelectPdf" and install it.
3.Create a new ASPX page (e.g., "DocumentViewer.aspx") for the Document Viewer.
4.In the ASPX page, add the necessary controls:
Add an control to allow users to upload their documents.
Add an control for the upload button.
Add an
5.In the code-behind file of the ASPX page, handle the event for the upload button click:
Use the FileUpload control to get the uploaded document.
Save the document to a temporary location on the server.
6.Convert the document to PDF format using a library like SelectPdf:
Set up the SelectPdf converter object.
Load the document from the temporary location.
Convert the document to PDF format.
Save the PDF file to another temporary location.
7.Set the source of the iframe control in the ASPX page to the URL of the generated PDF file.
Build and run the project to see the Document Viewer in action.