title: Display PDF file in WPF
body: <p>I am trying to display a PDF file in WPF. I have done it but after some time its stops working. Please help me below is my code:</p>
  
  <pre><code>else if (result.FileExtension == ".pdf")
  {
      // TODO: Make sure you point to a PDF on your system:
      var str = System.Text.Encoding.Default.GetString(result.ImageToByte);
      var uc = new UserControl1(str);
      this.windowsFormsHost1.Child = uc;
  }
  </code></pre>
  
  <p>Below is my UserControl code:</p>
  
  <pre><code>public UserControl1(string filename)
  {
      InitializeComponent();
      this.axAcroPDF1.LoadFile(filename);
  }
  </code></pre>
  
  <p>And the XAML:</p>
  
  <pre><code>&lt;WindowsFormsHost Margin="1" Name="windowsFormsHost1" /&gt;
  </code></pre>