How to View PDFs in .NET with IronPDF C#

IronPDF displays PDFs in .NET applications through the IronPdf.Viewer.Maui control for MAUI, by rasterizing pages to images with RasterizeToImageFiles for any UI framework, and through host controls such as WebView2 in WPF and Windows Forms. The right choice depends on what kind of app you are building and how much viewer chrome you need.

"Viewing" means different things across these paths. The MAUI viewer is a full interactive component with a toolbar. The rasterize path turns each page into an image you can show in any control. The WebView2 and default-viewer routes hand the file to a browser engine or the user's installed PDF reader. This article shows each one and is honest about what it does and does not give you.

Quickstart: View a PDF in MAUI with IronPDF

Add the IronPdf.Viewer.Maui NuGet package, call ConfigureIronPdfView() in MauiProgram.cs, then bind a PDF to an IronPdfView. The single line below loads a file into the viewer control.

  1. Install IronPDF with NuGet Package Manager

    PM > Install-Package IronPdf
  2. Copy and run this code snippet.

    new IronPdf.Viewer.Maui.IronPdfView { Source = IronPdf.Viewer.Maui.IronPdfViewSource.FromFile("document.pdf") };
  3. Deploy to test on your live environment

    Start using IronPDF in your project today with a free trial

    arrow pointer

Install the package first with Install-Package IronPdf.Viewer.Maui, and add your IronPDF license key in ConfigureIronPdfView to remove the trial banner. The MAUI viewer tutorial walks through the full project setup.


How Do I View PDFs in ASP.NET & MVC?

Serve the PDF from a controller action and embed it with an HTML iframe. The browser's built-in PDF viewer handles rendering, so the document appears inline while your page layout stays intact. When the PDF is generated on the fly, IronPDF's HTML to PDF conversion produces the file the action returns.

// Controller action to serve PDF
public ActionResult ViewPdf()
{
    var pdfPath = Server.MapPath("~/Content/sample.pdf");
    return File(pdfPath, "application/pdf");
}

// In your Razor view
<iframe src="@Url.Action("ViewPdf")" width="100%" height="600px"></iframe>
// Controller action to serve PDF
public ActionResult ViewPdf()
{
    var pdfPath = Server.MapPath("~/Content/sample.pdf");
    return File(pdfPath, "application/pdf");
}

// In your Razor view
<iframe src="@Url.Action("ViewPdf")" width="100%" height="600px"></iframe>
Imports System.Web.Mvc

' Controller action to serve PDF
Public Function ViewPdf() As ActionResult
    Dim pdfPath = Server.MapPath("~/Content/sample.pdf")
    Return File(pdfPath, "application/pdf")
End Function

' In your Razor view
<iframe src="@Url.Action("ViewPdf")" width="100%" height="600px"></iframe>
$vbLabelText   $csharpLabel

If you need text selection, zoom, and page navigation that you control rather than the browser default, render the PDF pages to images (shown below) and display them, or wire up a JavaScript viewer of your choice.


How Do I Display PDF Pages as Images in WPF, WinForms, or Blazor?

Call RasterizeToImageFiles to turn each PDF page into a PNG, then show those images in any control: a WPF Image, a WinForms PictureBox, or an <img> in a Blazor component. This is the IronPDF-native viewing path. It works the same on every UI framework and on every operating system IronPDF supports, because it produces plain image files rather than depending on a host browser control.

Input

:path=/static-assets/pdf/content-code-examples/how-to/net-pdf-viewer-rasterize.cs
using IronPdf;

// Load the PDF you want to display.
PdfDocument pdf = PdfDocument.FromFile("sample-report.pdf");

// Render every page to a PNG. The asterisk in the path is replaced with the page number,
// producing viewer-page-1.png, viewer-page-2.png, and so on. The last argument (100) is the DPI.
pdf.RasterizeToImageFiles("viewer-page-*.png", IronPdf.Imaging.ImageType.Png, 100);

// To show a page inside a GUI control without writing to disk, get in-memory bitmaps instead.
// ToBitmap returns one AnyBitmap per page; bind bitmaps[0] to a WPF Image or a WinForms PictureBox.
var bitmaps = pdf.ToBitmap();
bitmaps[0].SaveAs("viewer-firstpage.png");
Imports IronPdf

' Load the PDF you want to display.
Dim pdf As PdfDocument = PdfDocument.FromFile("sample-report.pdf")

' Render every page to a PNG. The asterisk in the path is replaced with the page number,
' producing viewer-page-1.png, viewer-page-2.png, and so on. The last argument (100) is the DPI.
pdf.RasterizeToImageFiles("viewer-page-*.png", IronPdf.Imaging.ImageType.Png, 100)

' To show a page inside a GUI control without writing to disk, get in-memory bitmaps instead.
' ToBitmap returns one AnyBitmap per page; bind bitmaps(0) to a WPF Image or a WinForms PictureBox.
Dim bitmaps = pdf.ToBitmap()
bitmaps(0).SaveAs("viewer-firstpage.png")
$vbLabelText   $csharpLabel

Output

First page of the sample report PDF rasterized to a PNG image for display in a .NET UI control

For an in-memory option, ToBitmap returns one image per page that you can bind to a control without touching the disk. Adjust the DPI argument to trade file size against sharpness, the same control you have over IronPDF's rendering options when producing the document.


How Do I View PDFs in WPF Applications?

Host the PDF in a WebView2 control, which uses the Chromium engine from Microsoft Edge and ships with its own PDF viewer (toolbar, zoom, and print included). Save the document to disk, then navigate the control to the file URI. WebView2 is the current replacement for the older WebBrowser control, which relied on the deprecated Internet Explorer engine.

:path=/static-assets/pdf/content-code-examples/how-to/net-pdf-viewer-wpf-viewer.cs
// WPF: display a PDF using the WebView2 control (Microsoft Edge / Chromium).
// Install the NuGet package Microsoft.Web.WebView2 and add a <wv2:WebView2 x:Name="pdfWebView" />
// element to your XAML (xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf").
// WebView2 renders PDFs with the same built-in viewer as the Edge browser (toolbar, zoom, print).
using System;
using System.IO;

// Save the IronPDF-generated document to disk first, then point WebView2 at it.
var pdf = new IronPdf.ChromePdfRenderer().RenderHtmlAsPdf("<h1>Hello IronPDF</h1>");
string pdfPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "document.pdf");
pdf.SaveAs(pdfPath);

// pdfWebView is the WebView2 control declared in your XAML.
// EnsureCoreWebView2Async must complete before navigating.
await pdfWebView.EnsureCoreWebView2Async();
pdfWebView.CoreWebView2.Navigate(new Uri(pdfPath).AbsoluteUri);

// Legacy alternative: the older System.Windows.Controls.WebBrowser control still works on
// Windows machines that have a PDF handler installed, but it relies on the deprecated Internet
// Explorer engine and is not recommended for new applications. Prefer WebView2 above.
Imports System
Imports System.IO
Imports IronPdf

' WPF: display a PDF using the WebView2 control (Microsoft Edge / Chromium).
' Install the NuGet package Microsoft.Web.WebView2 and add a <wv2:WebView2 x:Name="pdfWebView" />
' element to your XAML (xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf").
' WebView2 renders PDFs with the same built-in viewer as the Edge browser (toolbar, zoom, print).

' Save the IronPDF-generated document to disk first, then point WebView2 at it.
Dim pdf = New ChromePdfRenderer().RenderHtmlAsPdf("<h1>Hello IronPDF</h1>")
Dim pdfPath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "document.pdf")
pdf.SaveAs(pdfPath)

' pdfWebView is the WebView2 control declared in your XAML.
' EnsureCoreWebView2Async must complete before navigating.
Await pdfWebView.EnsureCoreWebView2Async()
pdfWebView.CoreWebView2.Navigate(New Uri(pdfPath).AbsoluteUri)

' Legacy alternative: the older System.Windows.Controls.WebBrowser control still works on
' Windows machines that have a PDF handler installed, but it relies on the deprecated Internet
' Explorer engine and is not recommended for new applications. Prefer WebView2 above.
$vbLabelText   $csharpLabel

WarningWebView2 requires the Microsoft Edge WebView2 Runtime on the target machine. It is preinstalled on current Windows 11 builds; for older systems, ship the Evergreen bootstrapper with your installer.


Icon Quote related to How Do I View PDFs in WPF Applications?

My favorite library of this kind is IronPDF. It allows for fast and efficient manipulation of PDF files. It also has many valuable features, like exporting to PDF/A format and digitally signing PDF documents.

Milan Jovanovic related to How Do I View PDFs in WPF Applications?

Milan Jovanovic

Microsoft MVP

View case study
Icon Quote related to How Do I View PDFs in WPF Applications?

IronOCR means we can save $40,000 annually from manual processing, while enhancing productivity and freeing up resources for high-impact tasks. I would highly recommend it.

Brent Matzelle related to How Do I View PDFs in WPF Applications?

Brent Matzelle

Chief Technology Officer, OPYN

View case study
Icon Quote related to How Do I View PDFs in WPF Applications?

The IronSuite play a crucial role in our operations. These are tools that increase efficiencies across the business including creating floor plans and improving inventory management.

David Jones related to How Do I View PDFs in WPF Applications?

David Jones

Lead Software Engineer, Agorus Build

View case study

How Do I View PDFs in Windows Forms?

Drop a WebView2 control onto your form and point it at the saved PDF, exactly as in WPF. The control initializes asynchronously, so await EnsureCoreWebView2Async before calling Navigate. This gives WinForms apps the same Chromium-based viewer without bundling a third-party component.

:path=/static-assets/pdf/content-code-examples/how-to/net-pdf-viewer-winforms-viewer.cs
// Windows Forms: display a PDF using the WebView2 control (Microsoft Edge / Chromium).
// Install the NuGet package Microsoft.Web.WebView2, then drag a WebView2 control onto your form
// (or add it in code) and name it pdfWebView.
using System;
using System.IO;

// Generate or load the PDF with IronPDF, then save it so WebView2 can open the file.
var pdf = new IronPdf.ChromePdfRenderer().RenderHtmlAsPdf("<h1>Hello IronPDF</h1>");
string pdfPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "document.pdf");
pdf.SaveAs(pdfPath);

// pdfWebView is the WebView2 control on your form.
// Initialize the runtime, then navigate to the local file URI.
await pdfWebView.EnsureCoreWebView2Async();
pdfWebView.CoreWebView2.Navigate(new Uri(pdfPath).AbsoluteUri);

// Legacy alternative: the System.Windows.Forms.WebBrowser control can host a PDF when a system
// PDF handler is registered, but it uses the deprecated Internet Explorer engine. Use WebView2
// for new projects so the viewer works consistently across modern Windows installs.
Imports System
Imports System.IO
Imports IronPdf

' Generate or load the PDF with IronPDF, then save it so WebView2 can open the file.
Dim pdf = New ChromePdfRenderer().RenderHtmlAsPdf("<h1>Hello IronPDF</h1>")
Dim pdfPath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "document.pdf")
pdf.SaveAs(pdfPath)

' pdfWebView is the WebView2 control on your form.
' Initialize the runtime, then navigate to the local file URI.
Await pdfWebView.EnsureCoreWebView2Async()
pdfWebView.CoreWebView2.Navigate(New Uri(pdfPath).AbsoluteUri)

' Legacy alternative: the System.Windows.Forms.WebBrowser control can host a PDF when a system
' PDF handler is registered, but it uses the deprecated Internet Explorer engine. Use WebView2
' for new projects so the viewer works consistently across modern Windows installs.
$vbLabelText   $csharpLabel

If you would rather not host a browser control at all, the image-based approach from the section above drops straight into a PictureBox and avoids the WebView2 runtime dependency entirely.


How Do I View PDFs in the Default System PDF Viewer?

Pass the file path to System.Diagnostics.Process.Start to open the PDF in whatever reader the user has set as default, such as a browser or Adobe Acrobat. This hands rendering to an external application rather than embedding it, which suits utilities and batch tools that only need to show the finished file.

:path=/static-assets/pdf/content-code-examples/how-to/net-pdf-viewer-default-pdf-viewer.cs
using IronPdf;

// Render any HTML fragment or document to HTML
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Hello IronPdf</h1>");

var outputPath = "ChromePdfRenderer.pdf";

// Export PDF document
pdf.SaveAs(outputPath);

// This neat trick opens our PDF file so we can see the result in our default PDF viewer
System.Diagnostics.Process.Start(outputPath);
Imports IronPdf

' Render any HTML fragment or document to HTML
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello IronPdf</h1>")

Private outputPath = "ChromePdfRenderer.pdf"

' Export PDF document
pdf.SaveAs(outputPath)

' This neat trick opens our PDF file so we can see the result in our default PDF viewer
System.Diagnostics.Process.Start(outputPath)
$vbLabelText   $csharpLabel

In production, wrap the call so a missing PDF handler does not crash the app:

try
{
    var psi = new System.Diagnostics.ProcessStartInfo
    {
        FileName = outputPath,
        UseShellExecute = true
    };
    System.Diagnostics.Process.Start(psi);
}
catch (Exception ex)
{
    // Handle the case where no PDF viewer is installed
    MessageBox.Show($"Unable to open PDF: {ex.Message}");
}
try
{
    var psi = new System.Diagnostics.ProcessStartInfo
    {
        FileName = outputPath,
        UseShellExecute = true
    };
    System.Diagnostics.Process.Start(psi);
}
catch (Exception ex)
{
    // Handle the case where no PDF viewer is installed
    MessageBox.Show($"Unable to open PDF: {ex.Message}");
}
Imports System.Diagnostics
Imports System.Windows.Forms

Try
    Dim psi As New ProcessStartInfo With {
        .FileName = outputPath,
        .UseShellExecute = True
    }
    Process.Start(psi)
Catch ex As Exception
    ' Handle the case where no PDF viewer is installed
    MessageBox.Show($"Unable to open PDF: {ex.Message}")
End Try
$vbLabelText   $csharpLabel

Conclusion

Each viewing path here trades interactivity for portability: the MAUI viewer gives a full toolbar, rasterizing to images works in any UI on any platform, WebView2 reuses the Edge engine, and Process.Start defers to the user's reader. Pick the one that matches your app rather than forcing a single answer.

Since most viewing starts with a document you generated, pair these techniques with the full MAUI viewer tutorial when you need an interactive toolbar component.

Frequently Asked Questions

How can I display PDFs in a .NET MAUI application?

IronPDF ships an interactive PDF viewer component for MAUI projects in the IronPdf.Viewer.Maui NuGet package. After installing the package and calling ConfigureIronPdfView(), you can bind a PDF to an IronPdfView control, loading it from a file with IronPdfViewSource.FromFile or from a stream. This MAUI component is the only path that gives a built-in toolbar; on desktop and web you view PDFs by hosting WebView2, embedding an iframe, or rasterizing pages to images.

What's the easiest way to view PDFs in ASP.NET web applications?

For ASP.NET applications, IronPDF supports viewing PDFs through browser windows or iframes. The iframe approach is particularly effective as it maintains your application's layout while displaying PDF content inline. You can also use IronPDF's HTML to PDF conversion capabilities to generate dynamic PDFs on the fly for viewing.

Can I integrate PDF viewing into WPF and WinForms applications?

Yes. For WPF and WinForms, host a WebView2 control and navigate it to a saved PDF; WebView2 uses the Chromium engine from Microsoft Edge and includes its own toolbar, zoom, and print. WebView2 replaces the older WebBrowser control that relied on the deprecated Internet Explorer engine. If you would rather not host a browser control, rasterize each page to an image with RasterizeToImageFiles and show it in an Image or PictureBox. IronPDF also handles digital signatures, form filling, and PDF compression on the same documents.

Is it possible to use the system's default PDF viewer with .NET applications?

Absolutely. IronPDF supports integration with the system's default PDF viewer using System.Diagnostics.Process. This approach allows you to open PDFs in the user's preferred PDF application while still using IronPDF to generate, manipulate, or prepare the PDF documents beforehand.

What additional PDF features are available beyond just viewing?

IronPDF offers a wide range of PDF functionality including digital signatures for document security, form filling capabilities for interactive PDFs, PDF compression to reduce file sizes, HTML to PDF conversion for dynamic content generation, and saving/exporting PDFs in various formats.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 19,570,275 | Version: 2026.6 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package IronPdf
run a sample watch your HTML become a PDF.