简体   繁体   中英

How to add a free document viewer to a web project?

I'm developing a web project with asp.net and c #. (Excel, word, powerpoint, image, etc.) But I couldn't find a free document viewer . Is there an easy way to do this? I would like to add a document viewer to my free project.

You have 2 options to achieve the functionality that you are wanting. Your first option will be to use a combination of various open source libraries in order to get it to work. The second option will be to use a commercial sdk.

Option 1 - Open Source (Pdf.js, iTextSharp, Microsoft.Office.Interop)

To add a document viewer to your web application that isn't using an iframe with google docs, you could look into using PDF.JS. Here is information on how to view PDFs using PDF.JS: Using PDF.JS to display PDFs in web browser

Then the next step is converting your documents and images to PDF. You can convert all of your input images to PDF using iTextSharp: How to use iTextSharp to convert to PDF

Then you have to figure out how to convert the office formats to PDF. One option is using the Microsoft.Office.Interop to achieve this: How to: Use Microsoft Office Interop C#

This allows you to use the Microsoft Office software installed on your machine to do the conversions for you.

Option 2 - Commercial SDK (LEADTOOLS)

Disclaimer: I am an employee of this company

The LEADTOOLS SDK is a commercial SDK that provides you with a DocumentViewer Control that you can embed in your application to display all different kinds of formats, including over 150+ different image formats as well as all of the common Office formats. One of the many benefits is that you do not have to use the Microsoft.Office.Interop to view the Microsoft formats as the LEADTOOLS SDK has native support for each office format.

You can demo the Document Viewer here : https://demo.leadtools.com/JavaScript/DocumentViewer/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM