IRONSOFTWAREHOME

How to View PDFs in .NET with IronPDF C#

Curtis Chau
Curtis Chau
Updated: September 17, 2026

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. 1Install IronPDF with NuGet Package Manager

    PM > Install-Package IronPdf

  2. 2Copy and run this code snippet.

    new IronPdf.Viewer.Maui.IronPdfView { Source = IronPdf.Viewer.Maui.IronPdfViewSource.FromFile("document.pdf") };
    C#
  3. 3Deploy 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>

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

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");
C#

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.


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

Microsoft MVP

View case study

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

Chief Technology Officer, OPYN

View case study

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

Lead Software Engineer, Agorus Build

View case study

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.

// 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.
C#
Warning: WebView2 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.

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.

// 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.
C#

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.

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);

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}");
}

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 embed a PDF in an ASP.NET application using IronPDF?

You can serve the PDF from a controller action and embed it in an HTML iframe. The built-in browser PDF viewer will handle rendering, maintaining your page layout.

What are the different ways to view PDFs in .NET using IronPDF?

IronPDF supports viewing PDFs through the MAUI viewer, by rasterizing pages to images, using WebView2 in WPF and Windows Forms, and by opening with the default system PDF viewer.

How do I display a PDF in a MAUI application using IronPDF?

Install the IronPdf.Viewer.Maui NuGet package, configure it in MauiProgram.cs, and bind a PDF to an IronPdfView using IronPDF’s MAUI viewer component.

Can I convert PDF pages to images for display on any platform with IronPDF?

Yes, you can use the RasterizeToImageFiles method in IronPDF to convert each PDF page into a PNG image, suitable for any UI framework.

What is the advantage of using WebView2 for displaying PDFs in WPF applications?

WebView2 utilizes the Chromium engine from Microsoft Edge, providing built-in PDF viewing features like toolbar, zoom, and print, and is recommended over the older WebBrowser control.

How can I open a PDF in the default system viewer using IronPDF?

Use System.Diagnostics.Process.Start with the PDF file path to open it in the user's default PDF reader, such as a browser or Adobe Acrobat.

Is it possible to display PDFs in Blazor applications with IronPDF?

Yes, you can convert each PDF page to an image using IronPDF's RasterizeToImageFiles, and display those images using an img tag in a Blazor component.

What should I do if the default PDF viewer is not installed on the user's system?

Wrap the System.Diagnostics.Process.Start call in a try-catch block to handle cases where a PDF viewer is missing, ensuring your application does not crash.

How can IronPDF's MAUI viewer enhance my application's PDF viewing experience?

The MAUI viewer provides a full interactive component with a toolbar, allowing users to interact with the PDF directly within your app.

Can I use IronPDF to integrate PDF viewing capabilities without depending on browser controls?

Yes, by rasterizing PDF pages to images, you can integrate viewing capabilities in any UI framework without relying on browser-based controls.

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 21,105,021Version:2026.9just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999