Free Support Forum - groupdocs.com

How to render a document using Viewer API in .NET Core MVC

I am trying to test GroupDocs.Viewer with DotNet Core MVC app. The code seems pretty simple and it appears to work but I don’t see any results. I thought this product was a “Viewer”. It seems very simple to use but I’m assuming I’m missing an important step. I’m using the simplest of tests. The following code is called from within a controller.
public IActionResult GetDocs()
{
using (Viewer viewer = new Viewer(@“E:\temp\ODLAZURE-JAN-2020.pdf”))
{
PdfViewOptions viewOptions = new PdfViewOptions();
var test = viewOptions.GetType();
viewer.View(viewOptions);
}
Return View()
}

1 Like

@marlodan19,

The core feature of the API is to take a source file as input and then convert or render it to PDF, Image or HTML formats. Later, the rendered output could be displayed in the browser or in any application (e.g. Windows form). Please have a look at this answer.
Have a look at this sample application. You just have to add GroupDocs.Viewer for .NET API version 20.4 reference in the project and it will take a sample document from Source Documents folder that is available in the project and display it in the browser (at back-end, it will save converted file to Output folder).