.netwpfpdfwindowsformshost

Display PDF Takes Focus and Eats Hot Key


Used code I found on SO to use the COM based Acrobat Reader to display PDF via hosting in a WindowsFormsHost.

It displays the PDF fine. Two problems:

I understand this is COM and Adobe in WPF and there may not be an answer. If there is a free or cheap WPF control to view PDF I would be happy to go down that path. This is for a commercial application so it has to be free (or cheap) for commercial use.

 <Button  Click="Button_Click">_Next</Button>     

 <WindowsFormsHost Name="windowsFormsHost1"  Margin="1" />
 UserControl1 UC = new UserControl1(@"C:\temp\1000001.pdf");
 this.windowsFormsHost1.Child = UC;


 public UserControl1(string filename)
 {
     InitializeComponent();
     this.axAcroPDF1.LoadFile(filename);
 }

This does display PDF. In the production application I display various PDFs based on used actions.


Solution

  • What Hans said. Acrobat appears to be eating key strokes and there is nothing I can do about it.