[英]How do I display a PDF Named Destination in Windows Server 2012 or 2016 in default Edge Browser from a .net C# app?
Language: C# .net I have tried the Adobe method which requires Adobe Reader.语言:C# .net 我尝试了需要 Adobe Reader 的 Adobe 方法。 Even it does not work well - I want to open the file to a destination, then change the destination as the user clicks on a Context Help icon.即使它不能很好地工作 - 我想将文件打开到目的地,然后在用户单击即时帮助图标时更改目的地。 I do NOT want multiple new windows to clutter the screen.我不希望多个新窗口弄乱屏幕。
I am trying to open a PDF to a named destination using the default PDF reader in Windows 2012 Server.我正在尝试使用 Windows 2012 Server 中的默认 PDF 阅读器将 PDF 打开到指定目的地。 (and same in windows server 2016). (在 Windows Server 2016 中也是如此)。 I don't want to force users to install Adobe PDF Reader.我不想强迫用户安装 Adobe PDF Reader。 I want to use the default browser-based reader on a standard install.我想在标准安装中使用默认的基于浏览器的阅读器。
WHen I use the Adobe method, if I use the n flag, I get a new window every time - annoying.当我使用 Adobe 方法时,如果我使用 n 标志,我每次都会得到一个新窗口 - 烦人。 If I don't use the n flag, I can open ONE window;如果我不使用 n 标志,我可以打开一个窗口; all subsequent calls to change the topic are ignored.所有随后更改主题的调用都将被忽略。
Open the Windows Setting, click the Apps, select the Default Apps option and choose the "Choose default apps by file type", then find the .pdf file name and choose the Microsoft Edge as default apps to view the file.打开 Windows 设置,单击应用程序,选择默认应用程序选项并选择“按文件类型选择默认应用程序”,然后找到 .pdf 文件名并选择 Microsoft Edge 作为默认应用程序以查看文件。 like this.像这样。
Then, using the following code to open the pdf file using Edge browser:然后,使用以下代码使用 Edge 浏览器打开 pdf 文件:
Process.Start("file path. such as: 'file:///C:/Users/XXX/Downloads/pdf.pdf'");
From your description, it seems that the pdf file is located on the remote server, I think you could download to local folder first, then using the above code to display the PDF file.从你的描述来看,pdf文件似乎在远程服务器上,我觉得你可以先下载到本地文件夹,然后使用上面的代码来显示PDF文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.