简体   繁体   English

如何在 Windows Server 2012 或 2016 中的默认 Edge 浏览器中从 .net C# 应用程序显示 PDF 命名目标?

[英]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 我尝试了需要 Adob​​e Reader 的 Adob​​e 方法。 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.我不想强迫用户安装 Adob​​e 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.当我使用 Adob​​e 方法时,如果我使用 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.

相关问题 C#DateTime toString在Windows Server 2012和2016上的行为不同 - C# DateTime toString behaves differently on windows server 2012 and 2016 仅在浏览器中显示PDF一次,然后将其从服务器C#中删除 - Display PDF in a browser Only ONCE and delete it from server C# 如何在C#中使用iTextSharp编辑PDF文件中的命名目标? - How to edit named destination in PDF file using iTextSharp with C#? 在Windows Server 2012 R2中使用C#.NET Rest API打印PDF文件时出错 - Error printing PDF file using C# .NET Rest API in Windows Server 2012 R2 C#ASP.NET MVC:如何让浏览器从我的响应中自动下载pdf? - C# ASP.NET MVC: How do I get the browser to automatically download a pdf from my response? 如何在Windows Server 2016 / 2012r2上解决500个内部服务器错误Bot框架(C#SDK) - How to resolve 500 Internal Server Error Bot framework (C# SDK) on Windows Server 2016/2012r2 我可以使用 C#(MVC 或核心)从 Windows Server 2016 中的“Windows”文件夹中删除文件吗? - Can I delete files from “Windows” folder in Windows Server 2016 using C# (MVC or Core)? ASP.NET/C#如何在PDF上显示PNG - ASP.NET/C# How Do I Display a PNG on a PDF 使用asp.net C#将SQL Server 2016中的一个数据库复制到SQL Server 2012中的另一个数据库 - Copy one database in SQL Server 2016 to another in SQL Server 2012 using asp.net C# 如何将 C# 控制台应用程序设置为使用默认控制台设置 (Windows Server 2012)? - How to set C# Console Application to use default console settings (Windows Server 2012)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM