PDFRasterizer.NET 4.0 is now available. Supports .NET Core. Renders pixel-perfectly.

Convert PDF to WPF XPS

Note This chapter only applies to the .NET 3.0 build.

In addtion to rendering PDF pages to raster images such as BMP, PNG and JPG, PDFRasterizer,NET 3.o also lets you convert PDF documents to WPF graphics or XPS documents. All vector graphics are preserved. This is new as of version 3.0.

Save PDF as XPS

Central to the conversion to WPF/XPS are the Document.ConvertToWpf and Page.ConvertToWpf methods. These methods create WPF FixedDocument and WPF FixedPage instances, respectively.

The following basic code sample demonstrates how to create a FixedDocument from a PDF document:

static void Main(string[] args)
   using (FileStream pdfFile = new FileStream(
      @"document.pdf", FileMode.Open, FileAccess.Read))
      RenderSettings renderSettings = new RenderSettings();
      ConvertToWpfOptions options = new ConvertToWpfOptions();

      Document document = new Document(pdfFile);
      FixedDocument fixedDocument = document.ConvertToWpf(
         renderSettings, options);

      XpsDocument xpsDocument= new XpsDocument(
         @"document.xps", FileAccess.ReadWrite);
      XpsDocumentWriter xpsWriter =

Code sample: Save a PDF document as XPS

Note that the calling threat must live in an STA. Unfortunately COM still haunts us today.

Display PDF pages as WPF graphics

This is demonstrated by code sample ViewPDF_WPF which is included in the product download.

Code samples

The following code samples are included in the distribution and are relevant to converting PDF documents to WPF/XPS:  

  • ConvertToXPS
  • ViewPDF_WPF

Download PDFRasterizer.NET 3.0
We will send you a download link
  • This field is for validation purposes and should be left unchanged.
Why do we ask your email address?
We send tips that speed up your evaluation
We let you know about bug fixes
You can always unsubscribe with one click
We never share your address with a 3rd party
Thank you for your download

We have sent an email with a download link.