wpfpdf

Display a PDF in WPF Application


Any ideas how to display a PDF file in a WPF Windows Application?


I am using the following code to run the browser but the Browser.Navigate method does not do anything!

WebBrowser browser = new WebBrowser();
browser.Navigate("http://www.google.com");
this.AddChild(browser); // this is the System.Windows.Window

Solution

  • Oops. this is for a winforms app. Not for WPF. I will post this anyway.

    try this

    private AxAcroPDFLib.AxAcroPDF axAcroPDF1;
    this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();
    this.axAcroPDF1.Dock = System.Windows.Forms.DockStyle.Fill;
    this.axAcroPDF1.Enabled = true;
    this.axAcroPDF1.Name = "axAcroPDF1";
    this.axAcroPDF1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF1.OcxState")));
    axAcroPDF1.LoadFile(DownloadedFullFileName);
    axAcroPDF1.Visible = true;