View File Service

Viewing file as a service is similar to viewing a file in the viewer. In this case there is no user interface involved rather it is used to export the file to pdf or png or to open it in a non-web environments like a windows application or web service. This method return back true when successful otherwise false.

string filePath, BaseOptions config
var pdfOptions = new PdfOptions{ AllowSearch = true };
ViewFileService("C:\files\Word.doc", new WordOptions {ConvertPdf = true, PdfOptions = pdfOptions});
byte[] fileBytes, ViewFileFormat fileExt, BaseOptions config
var xlsBytes = File.ReadAllBytes("C:\files\Excel.xls");
ViewFileService(xlsBytes, ViewFileFormat.Xls, new ExcelOptions{ExportOnePagePerWorkSheet = true});
Stream fileStream, FileInfo fileInfo, BaseOptions config
var filePath = "C:\files\Resume.pdf";
using var pdfStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
ViewFileService(pdfStream, new FileInfo(filePath), new PdfOptions());