Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display a PDF in WPF Application [closed]

Tags:

pdf

wpf

You can get the Acrobat Reader control working in a WPF app by using the WindowsFormHost control. I have a blog post about it here:

http://hugeonion.com/2009/04/06/displaying-a-pdf-file-within-a-wpf-application/

I also have a 5 minute screencast of how I made it here:

http://www.screencast.com/t/JXRhGvzvB


You could simply host a Web Browser control on the form and use it to open the PDF.

There's a new native WPF "WebBrowser" control in .NET 3.51, or you could host the Windows.Forms browser in your WPF app.


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;

Try MoonPdfPanel - A WPF-based PDF viewer control http://www.codeproject.com/Articles/579878/MoonPdfPanel-A-WPF-based-PDF-viewer-control

GitHub: https://github.com/reliak/moonpdf