View files from database

Hi,


We have recently got a requirement to display documents in browser. Our client suggested for groupdocs to used. However we want to check how it works with file data saved in database. We are new to it , so could you please provide some samples that will allow documents to show in browser without saving it to client machine.
Please note - Documents are saved in sql server database in binary format.

Please help us asap so that our client can make a decision.

Thanks & Regards
P

@pankaj123,


Thanks for taking interest in GroupDocs.Viewer for .NET.

GroupDocs.Viewer for .NET is a standalone, back-end document rendering API that renders the source document’s pages into HTML pages or images as per user’s choice. When using the API in a web application, for instance, the rendering will be done on the server side and the user will view the HTML/image representation of the document in the browser. Hence, the documents will not be saved on client’s machine. Following are some useful resources that include documentation, example projects, and the open source document viewer applications that may help you understand the working of the API.


Furthermore, GroupDocs.Viewer for .NET also supports working with file streams. In your case, you can convert the byte array into file stream and then use that stream to render the document into HTML pages or images. For more details, please visit Working with Streams.

In case you would have any questions or queries, please feel free to let us know.

Warm Regards


Hi Usman,


Thanks for your quick reply.

So i am following your given example
https://docs.groupdocs.com/display/viewernet/Working+with+Streams
So as per the code, it will save the document on disk first and then it will display document? or what it will do exactly?
second point is do we need to add anything on aspx page or we need to add just this code on .aspx.cs file?

Thanks & Regards
P


Hi Usman,


Could you please help me out to display documents from database?

I am able to convert byte array to html and images but i dont know how to display them in browser then. Could you please provide a linked sample application that will shows complete working for the same?

This is pretty urgent for us as client is very eager to purchase the developer license.

Thanks & Regards
P

@pankaj123,


Thanks for coming back.

As I mentioned before, GroupDocs.Viewer for .NET is a back-end API that provides you HTML or image representation of the source document. You will need to create you own front end application to view/display the rendered HTML pages or images. You can also use our open source document viewer applications. Currently, these applications are working with the documents located in the storage directory, however, as these applications are open source, you can change their functionality to work with files saved in database. Following are the open source document viewer applications that are available on GitHub.


We would also recommend you to have a look at the Documentation of the API for better understanding. In case you would need any further assistance, please do let us know.

Warm Regards

Hi Usman,


Thanks for your answer.
I have already gone through the open source application and documentation many times. However i did not find a way to directly display documents from stream. I can get the list of html pages or images from the stream but then i did not find any way to display them in viewer control.

Open source code using many handlers and that contains may other files as well, so i am not sure do we need to use all the things to achieve straight forward functionality.

Please explain how to display list of pages in viewer control.

Thanks & Regards
P

@pankaj123,


Thanks for your response.

As I mentioned in the previous post, GroupDocs.Viewer for .NET is a back-end API and it doesn’t contain any front end viewer control to display the rendered document. You will have to create the front end UI to display the output HTML pages or images.

In your case, if you want to achieve a simple and straight forward functionality then you can follow the steps bellow:

  1. Get HTML pages or images using GetPages function of GroupDocs.Viewer for .NET
  2. Save the HTML pages or images somewhere
  3. Display/load the HTML pages or images in your application (for instance, if you have an ASP.NET Webforms application, then you can load the HTML page inside a div in a .aspx page)

To get an idea of how to save the HTML pages or images of the source document, please have a look at ViewGenerator.cs class of the example project. If you would find any thing difficult, please do let us know.

Warm Regards

Hi Usman,


Thanks for your reply.

I got your point now. Let me try to create application in suggested way , i will come back to way if i get any questions.

Thanks & Regards
P

@pankaj123,


Sure, we’ll be looking forward to your feedback.

Warm Regards