我正在使用C#创建PDF文档。已成功创建并存储在我的驱动器中,但现在我想通过按下窗体上的按钮来打开该PDF文档。
我该如何做?
我正在使用AcropdfLib,但其中没有找到show()方法。
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
process.StartInfo = startInfo;
startInfo.FileName = @"C:\Users\user\Desktop\eBook.pdf";
process.Start();
在 Windows 窗体中加载 PDF
您可以使用 WebBrowser 控件通过将文件路径传递给 Navigate()
来加载 PDF。
private void OpenPdf(string filePath)
{
if (!string.IsNullOrWhiteSpace(filePath))
{
webBrowser1.Navigate(@filePath);
}
}