Simple Print Window in WPF (PDF and DOC)

I struggled with this for a few hours because the window would not close when the application closed using a WindowsFormHost and the solution was tons simpilar than I thought to begin with.

You make a window:





Title=”MyProj – Print”>

Then the code behind is simple:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Shapes;

namespace MyProj



/// Interaction logic for PrintPDFWindow.xaml


public partial class PrintPDFWindow : Window


private System.Windows.Forms.WebBrowser webbrowserOne;

public PrintPDFWindow()




public PrintPDFWindow(string filePath)



Uri uri = new Uri(filePath, UriKind.RelativeOrAbsolute);

this.webBrowser.Source = uri;




You call it like this:

PrintPDFWindow ppw = new PrintPDFWindow(currentMarketingPath + currentMarketingMaterial.MarketingMaterialURL);

ppw.Title = “MyProj – ” + currentMarketingMaterial.MarketingMaterialName;


That is it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.