How to C#: HTML5 Viewer
Open a File from Database
Open a File from Database
  |  
Home ›› XDoc.HTML5 Viewer ›› C# Viewer: Open a File from Database

C# HTML5 Viewer: Open a File from Your Database


How to Open a File from Database Using XDoc.HTML5 Viewer Control for C#




In addition to load and open file from URL and file on server, C# programmers can also load file to HTML5 viewer from database. Even though RasterEdge XDoc.HTML5 Viewer for .NET does not provide an example for file open from database, robust .NET APIs for this manipulation are provided for C# programmers. Please see detailed instruction below.




C#.NET APIs for Opening a File from Database



You may directly apply following two APIs in your C# program to load and open a file from database and view on created document viewer.


REDocumentControl.CreateWebDocFromByte(byte[] array, string fileName)


REDocumentControl.CreateWebDocFromStream(Stream stream, string fileName)


In the above APIs, parameters byte[] and stream are the file information got from database. And fileName is used to direct viewer to show the FileName of current file. If you want to add this function on your C# HTML5 Viewer, please refert to How to Edit Viewer Toolbar Commands.