GroupDocs.Viewer for .NET overview

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Viewer MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-viewer -- dnx GroupDocs.Viewer.Mcp --yes
Folders, licensing and more →

What is GroupDocs.Viewer?

GroupDocs.Viewer for .NET is a .NET document viewer and rendering API for C# that enables developers to view and render 190+ document and image formats without installing Microsoft Office or other third-party applications. It supports popular formats such as DOCX, PDF, XLSX, PPTX, CAD drawings, email messages, archives, eBooks, HTML, and raster images.

GroupDocs.Viewer can render documents to HTML, PDF, PNG, or JPG, making it suitable for document previews, web-based viewers, PDF generation, thumbnails, and server-side document processing. The library runs on-premises on supported Windows, Linux, and macOS environments.

Common use cases:

  • Document viewing and preview - render DOCX, PDF, XLSX, PPTX, CAD, email, and other files as HTML, PDF, or images and display them directly in web or desktop applications.
  • Server-side document rendering - convert documents to PDF or render individual pages as PNG or JPG images for previews, thumbnails, and document-processing workflows.
  • Web document viewers - generate HTML pages from documents and integrate document viewing into ASP.NET Core and other .NET applications.
  • Document conversion and publishing - render documents to PDF, HTML, or images for publishing, archiving, and content distribution.
  • AI and document processing workflows - render supported documents to page-level images or HTML for downstream processing, indexing, and analysis.
  • Document security and presentation - add text watermarks and configure PDF output options while rendering documents.

Key Capabilities

CapabilityDescription
190+ file formatsRender Word, Excel, PowerPoint, PDF, CAD, email, archive, eBook, HTML, image, and many other formats. See supported formats.
Multiple output formatsRender supported documents to HTML, PDF, PNG, or JPG.
HTML renderingGenerate HTML with embedded resources or separate CSS, fonts, and images using ForEmbeddedResources(...) or ForExternalResources(...).
Format-specific loading optionsConfigure passwords, fonts, encodings, spreadsheet settings, email options, and other input-specific parameters. See Loading.
Rendering optionsConfigure page size, DPI, image dimensions, rotation, watermarks, PDF permissions, and other output-specific settings.
Page selectionRender an entire document, selected pages, or individual pages.
Text watermarksAdd text watermarks during document rendering and configure their size, position, opacity, and other properties. See Add Text Watermark.
PDF output optionsConfigure PDF security, page order, image quality, and optimization when rendering to PDF.
AttachmentsExtract and save attachments from supported email, archive, and PDF documents.
Document informationGet information such as file type and page count without rendering the entire document.
Stream-based processingLoad documents from Stream, which is useful when processing files from cloud storage, databases, HTTP requests, or other sources.
Logging and diagnosticsConfigure logging through ViewerSettings and ConsoleLogger to help diagnose document-processing issues. See Logging.
CachingCache rendered results to improve performance when the same documents or pages are viewed repeatedly. See Caching Results.
On-premises deploymentProcess documents locally without sending files to a cloud-based document-rendering service or requiring Microsoft Office.

Quick Example

using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;

// Render a DOCX document to HTML - the hello-world example.
using (Viewer viewer = new Viewer("./sample.docx"))
{
    HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources("page_{0}.html");
    viewer.View(options);
}

sample.docx is the sample file used in this example. Click here to download it.

page_1.html (228 KB)
page_2.html (110 KB)
page_3.html (142 KB)
page_4.html (885 KB)
page_5.html (86 KB)

Download full output

The next example opens a password-protected document and renders it to PDF with a watermark:

using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;

// Open a password-protected DOCX, render to PDF with a watermark.
LoadOptions loadOptions = new LoadOptions();
loadOptions.Password = "secret";

using (Viewer viewer = new Viewer("./protected.docx", loadOptions))
{
    PdfViewOptions options = new PdfViewOptions("./protected.pdf");
    options.Watermark = new Watermark("CONFIDENTIAL");
    viewer.View(options);
}

protected.docx is the sample file used in this example. Click here to download it.

Binary file (PDF, 77 KB)

Download full output

Where to next

  1. Install GroupDocs.Viewer - follow the Installation guide to add the NuGet package or install GroupDocs.Viewer using the available distribution options.
  2. Render your first document - use Quick Start Guide to build and run a sample .NET application.
  3. Run GroupDocs.Viewer in Docker - see How to run GroupDocs.Viewer in Docker for a containerized .NET application.
  4. Learn document rendering - explore the Developer Guide for loading documents, rendering pages, retrieving document information, selecting pages, adding watermarks, and working with attachments.
  5. Render specific file formats - see Rendering Basics for examples covering PDF, Word, Excel, presentations, CAD, email, and other formats.
  6. Build a web-based document viewer - follow Integrate GroupDocs.Viewer in an ASP.NET Core Web App to build a self-hosted document viewer with a web UI, storage, and caching.