使用我在 SO 上找到的代码使用基于 COM 的 Acrobat Reader 通过托管在 WindowsFormsHost 中来显示 PDF。
它可以很好地显示 PDF。两个问题:
当我加载 PDF 时,控件 AxAcroPDFLib.AxAcroPDF 成为焦点
我希望专注于先前
当 AxAcroPDFLib.AxAcroPDF 获得焦点时,它会吃掉热键 (N)
ALT 键甚至没有在 N 下划线。即使用户选择 AxAcroPDFLib.AxAcroPDF,我也希望热键能够正常工作。
我知道这是 WPF 中的 COM 和 Adobe,可能没有答案。如果有免费或便宜的 WPF 控件来查看 PDF,我会很乐意走这条路。这是用于商业应用程序,因此必须免费(或便宜)用于商业用途。
<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);
}
这确实显示 PDF。在生产应用程序中,我根据使用的操作显示各种 PDF。