Nutrient

Home

SDK

Software Development Kits

Low-Code

IT Document Solutions

Workflow

Workflow Automation Platform

DWS API

Document Web Services

T
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Company

About

Team

Careers

Contact

Security

Partners

Legal

Resources

Blog

Events

Try for free

Contact Sales
Contact sales
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

products

Web

Web

Document Authoring

AI Assistant

Salesforce

Mobile

iOS

Android

visionOS

Flutter

React Native

MAUI

Server

Document Engine

Document Converter Services

.NET

Java

Node.js

AIDocument Processing

All products

solutions

USECASES

Viewing

Editing

OCR and Data Extraction

Signing

Forms

Scanning & Barcodes

Markup

Generation

Document Conversion

Redaction

Intelligent Doc. Processing

Collaboration

Authoring

Security

INdustries

Aviation

Construction

Education

Financial Services

Government

Healthcare

Legal

Life Sciences

All Solutions

Docs

Guides overview

Web

AIAssistant

Document Engine

iOS

Android

visionOS

Java

Node.js

.NET

Document Converter Services

Downloads

Demo

Support

Log in

Resources

Blog

Events

Pricing

Try for free

Free Trial

Company

About

Security

Partners

Legal

Contact Sales
Contact Sales
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

products

Products overview

Document Converter

Document Editor

Document Searchability

Document Automation Server

Integrations

SharePoint

Power Automate

Nintex

OneDrive

Teams

Window Servers

solutions

USECASES

Conversion

Editing

OCR Data Extraction

Tagging

Security Compliance

Workflow Automation

Solutions For

Overview

Legal

Public Sector

Finance

All Solutions

resources

Help center

Document Converter

Document Editor

Document Searchability

Document Automation Server

learn

Blog

Customer stories

Events

Support

Log in

Pricing

Try for free

Company

About

Security

Partners

Legal

Contact Sales
Contact Sales
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Product

Product overview

Process Builder

Form Designer

Document Viewer

Office Templating

Customization

Reporting

solutions

Industries

Healthcare

Financial

Manufacturing

Pharma

Education

Construction

Nonprofit

Local Government

Food and Beverage

Departments

ITServices

Finance

Compliance

Human Resources

Sales

Marketing

Services

Overview

Capex-accelerator

Process Consulting

Workflow Prototype

All Solutions

resources

Help center

guides

Admin guides

End user guides

Workflow templates

Form templates

Training

learn

Blog

Customer stories

Events

Support

Pricing

Support

Company

About

Security

Partners

Legal

Try for Free
Contact Sales
Try for Free
Contact Sales
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Services

Generation

Editing

Conversion

Watermarking

OCR

Table Extraction

Pricing

Docs

Log in

Try for Free
Try for Free

Free trial

Blog post

How to build a .NET WinUI3 PDF viewer with Nutrient Web SDK

Shantanu Methikar Shantanu Methikar

Table of contents

  • Prerequisites
  • Creating a new project
  • Adding Nutrient
  • Displaying a PDF in WinUI3
  • Running the application
  • Sample code
  • Conclusion
Illustration: How to build a .NET WinUI3 PDF viewer with Nutrient Web SDK

In this post, you’ll learn how to build a .NET WinUI3 PDF viewer with Nutrient Web SDK.

WinUI 3 is the native UI platform component that ships with the Windows App SDK, which is completely decoupled from Windows SDKs. The Windows App SDK provides a unified set of APIs and tools that can be used to create production desktop apps that target Windows 10 and later and can be published to the Microsoft Store.

Information

You can use similar steps to build a PDF viewer using Nutrient on other .NET platforms like WPF, WinForms, and anything else that supports WebView2.

Prerequisites

  • Windows 10 or later

  • Visual Studio or Visual Studio Code (this tutorial uses Visual Studio)

  • Select the Windows application development component in the installer when installing Visual Studio.

windows application development component

Follow the steps outlined below to build a WinUI3 PDF viewer with Nutrient Web SDK.

Creating a new project

  1. Open Visual Studio.

  2. Choose Create New Project.

  3. Choose Blank App, Packaged (WinUI 3 in Desktop) from the list. project type

  4. Click Next.

  5. Under Project name, enter PSPDFKitWinUI3Example. Then, press Create.

  6. Once the new solution is created, the project tree will look like what’s shown in the following image. initial project structure

Adding Nutrient

  1. Download the latest Nutrient Web SDK.

  2. Extract the ZIP file and copy the contents of package/dist to the Assets folder.

Displaying a PDF in WinUI3

  1. Add the PDF document you want to display, e.g. document.pdf, in the Assets folder.

  2. Add the index.html file to the Assets folder, and add the following code to the index.html file:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<meta
			name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
		/>
		<title>Nutrient Example App</title>

		<style>
			html,
			body {
				margin: 0;
				padding: 0;
				background: #f6f7fa;
			}

			header {
				display: none;
			}

			#root {
				width: 100vw;
				height: 100vh;
			}
		</style>
	</head>

	<body>
		<header></header>
		<div id="root"></div>

		<script src="./pspdfkit.js"></script>

		<script type="module">
			let instance = null;

			async function load(document) {
				if (instance) {
					PSPDFKit.unload(instance);
					hasUnsavedAnnotations = false;
					instance = null;
				}

				const configuration = {
					document,
					container: '#root',
					// Add when using a license key.
					// licenseKey: "LICENSE KEY GOES HERE",
				};

				instance = await PSPDFKit.load(configuration);
			}

			window.onload = () => load('./document.pdf');
		</script>
	</body>
</html>
  1. Double-click the project name to access the project file (PSPDFKitWinUI3Example.csproj) and replace the following:

<ItemGroup>
  <Content Include="Assets\SplashScreen.scale-200.png" />
  <Content Include="Assets\LockScreenLogo.scale-200.png" />
  <Content Include="Assets\Square150x150Logo.scale-200.png" />
  <Content Include="Assets\Square44x44Logo.scale-200.png" />
  <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
  <Content Include="Assets\StoreLogo.png" />
  <Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>

With this:

<ItemGroup>
  <Content Include="Assets\**\*" />
</ItemGroup>
  1. Replace the contents of the MainPage Window with:

<WebView2 x:Name="WebView" Loaded="WebView_Loaded" />
  1. Add the Loaded event handler in the MainPage.xaml.cs file to open index.html and display the PDF:

private async void WebView_Loaded(object sender, RoutedEventArgs e)
{
    await WebView.EnsureCoreWebView2Async();

    // Set the virtual host for the assets folder.
    WebView.CoreWebView2.SetVirtualHostNameToFolderMapping(
        "pspdfkit-example",
        "Assets",
        Microsoft.Web.WebView2.Core.CoreWebView2HostResourceAccessKind.Deny);

    WebView.CoreWebView2.Navigate("https://pspdfkit-example/index.html");
}

Running the application

  1. Press F5 to run the application.

  2. The application will open with the PDF document displayed in the WebView2 control.

    PDF displayed in WebView2 control

Sample code

The code for the example in this post can be found in our PSPDFKit-labs GitHub repository.

Conclusion

In this post, you learned how to build a WinUI3 PDF viewer with Nutrient Web SDK. You can use similar steps to build a PDF viewer using Nutrient on other .NET platforms like WPF and WinForms, or anything that supports WebView2.

Author
Shantanu Methikar
Shantanu Methikar .NET Engineer

Shantanu likes to explore and experiment — be it with technology, traveling, food, or almost anything else.

Explore related topics

.NET WinUI3 How To PDF Viewer
Free trial Ready to get started?
Free trial

Related articles

Explore more
SDKPRODUCTSReleases.NET

Auto-tagging and conversion to AI-friendly formats — The latest document accessibility enhancements in .NET SDK

SDKTUTORIALSPrint PDF.NETC#PDF

How to Print a PDF in C# with PSPDFKit

SDKTUTORIALS.NETHow ToBlazorPDF Generation

How to generate a PDF in Blazor with PDFsharp

Company
About
Security
Team
Careers
We're hiring
Partners
Legal
Products
SDK
Low-Code
Workflow
DWS API
resources
Blog
Events
Customer Stories
Tutorials
News
connect
Contact
LinkedIn
YouTube
Discord
X
Facebook
Popular
Java PDF Library
Tag Text
PDF SDK Viewer
Tag Text
React Native PDF SDK
Tag Text
PDF SDK
Tag Text
iOS PDF Viewer
Tag Text
PDF Viewer SDK/Library
Tag Text
PDF Generation
Tag Text
SDK
Web
Tag Text
Mobile/VR
Tag Text
Server
Tag Text
Use Cases
Tag Text
Industries
Tag Text
Resources
Blog
Tag Text
Events
Customer Stories
Tag Text
Tutorials
Tag Text
Features List
Tag Text
Compare
Tag Text
community
Free Trial
Tag Text
Documentation
Tag Text
Nutrient Portal
Tag Text
Contact Support
Tag Text
Company
About
Tag Text
Security
Tag Text
Careers
Tag Text
Legal
Tag Text
Pricing
Tag Text
Partners
Tag Text
connect
Contact
Tag Text
LinkedIn
Tag Text
YouTube
Tag Text
Discord
Tag Text
X
Tag Text
Facebook
Tag Text
low-code
Document Converter
Tag Text
Document Editor
Tag Text
Document Automation Server
Tag Text
Document Searchability
Tag Text
Use Cases
Tag Text
Industries
Tag Text
Resources
Blog
Tag Text
Events
Customer Stories
Tag Text
Support
Help Center
Tag Text
Contact Support
Tag Text
Log In
Tag Text
Company
About
Tag Text
Careers
Tag Text
Security
Tag Text
Legal
Tag Text
Pricing
Tag Text
Partners
Tag Text
connect
Contact
Tag Text
LinkedIn
Tag Text
YouTube
Tag Text
Discord
Tag Text
X
Tag Text
Facebook
Tag Text
Popular
Approvals matrix
Tag Text
BPMS
Tag Text
Budgeting process
Tag Text
CapEx approval
Tag Text
CapEx automation
Tag Text
Document approval
Tag Text
Task automation
Tag Text
workflow
Overview
Tag Text
Services
Tag Text
Industries
Tag Text
Departments
Tag Text
Resources
Blog
Tag Text
Events
Customer Stories
Tag Text
Support
Help Center
Tag Text
FAQ
Tag Text
Troubleshooting
Tag Text
Contact Support
Tag Text
Company
About
Tag Text
Careers
Tag Text
Security
Tag Text
Legal
Tag Text
Pricing
Tag Text
Partners
Tag Text
connect
Contact
Tag Text
LinkedIn
Tag Text
YouTube
Tag Text
Discord
Tag Text
X
Tag Text
Facebook
Tag Text
DWS api
PDF Generator
Tag Text
Editor
Tag Text
Converter API
Tag Text
Watermark
Tag Text
OCR
Tag Text
Table Extraction
Tag Text
Resources
Log in
Tag Text
Help Center
Tag Text
Support
Tag Text
Blog
Tag Text
Company
About
Tag Text
Careers
Tag Text
Security
Tag Text
Pricing
Tag Text
Legal
Privacy
Tag Text
Terms
Tag Text
connect
Contact
Tag Text
X
Tag Text
YouTube
Tag Text
Discord
Tag Text
LinkedIn
Tag Text
Facebook
Tag Text

Copyright 2025 Nutrient. All rights reserved.

Thank you for subscribing to our newsletter!

We’re thrilled to have you join our community. You’re now one step closer to receiving the latest updates, exclusive content, and special offers directly in your inbox.

This builtin is not currently supported: DOM

PSPDFKit is now Nutrient. We've consolidated our group of trusted companies into one unified brand: Nutrient. Learn more

This builtin is not currently supported: DOM

PSPDFKit is now Nutrient. We've consolidated our group of trusted companies into one unified brand: Nutrient. Learn more

This builtin is not currently supported: DOM

New Feature Release. Tap into revolutionary AI technology to instantly complete tasks, analyze text, and redact key information across your documents. Learn More or View Showcase

This builtin is not currently supported: DOM

Aquaforest and Muhimbi are now Nutrient. We've consolidated our group of trusted companies into one unified brand: Nutrient. Learn more

This builtin is not currently supported: DOM

Integrify is now Nutrient. We've consolidated our group of trusted companies into one unified brand: Nutrient. Learn more

This builtin is not currently supported: DOM

Join us on April 15th. Join industry leaders, product experts, and fellow professionals at our exclusive user conference. Register for conference