This page explains how to set up and run the GroupDocs.Viewer for .NET code examples. The examples demonstrate common document rendering scenarios, including rendering documents to HTML, PDF, PNG, and JPEG, processing documents stored in archives, extracting attachments, and retrieving document information.
If you want to build a minimal application from scratch, see the Quick Start Guide.
Prerequisites
Before running the examples, make sure you have:
A configured environment that meets the requirements described in the System Requirements.
The examples are located in the Examples folder. Shared C# code is stored in GroupDocs.Viewer.Examples.CSharp, while separate projects target different .NET frameworks.
Make sure the license file exists at the specified location, or update LicensePath to point to your license file.
Note
For more details about licensing, evaluation limitations, and obtaining a temporary license, see the Licensing and evaluation page.
Running Examples
Run All Examples
RunExamples.cs in the selected startup project runs the available examples sequentially.
Run the project from the Examples directory:
dotnet run --project GroupDocs.Viewer.Examples.CSharp.Net
Replace the project name with GroupDocs.Viewer.Examples.CSharp.NetWindows or GroupDocs.Viewer.Examples.CSharp.Framework if you selected a different target framework.
In Visual Studio, press F5 to build and run the selected project.
The examples demonstrate scenarios such as:
Rendering documents to HTML, PDF, PNG, and JPEG.
Processing documents stored in archives.
Retrieving document information.
Applying different rendering options.
Extracting document attachments.
Run a Specific Example
To run only a specific example, open RunExamples.cs in the selected startup project and comment out the .Run() calls for the examples you do not need.
For example, the following configuration runs only the HelloWorld example:
The Demos folder contains ready-to-run applications that demonstrate how to integrate GroupDocs.Viewer into different types of .NET applications.
Clone or download the repository first, then follow the instructions for the demo you want to run.
ASP.NET Core Demo
Navigate to Demos/ASP.NET Core.
Run the application:
dotnet run
Open http://localhost:8080/viewer in your browser.
ASP.NET MVC Demo
Navigate to Demos/ASP.NET MVC.
Open the solution in Visual Studio.
Update the required parameters in web.config and the demo settings in configuration.yml. See the Configuration section.
Run the project.
Open http://localhost:8080/viewer in your browser.
ASP.NET Web Forms Demo
Navigate to Demos/ASP.NET Web Forms.
Open the solution in Visual Studio.
Update the required parameters in web.config and the example settings in configuration.yml. See the Configuration section.
Run the project.
Open http://localhost:8080/viewer in your browser.
WPF Demo
Navigate to Demos/WPF.
Open the solution in Visual Studio.
Run the project.
Windows Forms Demo
Navigate to Demos/Windows Forms.
Open the solution in Visual Studio.
Run the project.
Contribute
You can contribute to the GroupDocs.Viewer examples by adding new examples or improving existing ones. The examples repository is open source and can be used in your own applications.
To contribute:
Fork the repository.
Modify or add an example.
Create a pull request.
The changes will be reviewed and incorporated into the repository when appropriate.
Troubleshooting
If you encounter problems while running the examples:
Make sure all NuGet packages are restored successfully.
Verify that the selected project matches your target framework and operating system.