How to add a link to open a file without a Win10 security warning in iTextSharp v5
When creating a new PDF file using iTextSharp I am able to create a link in the document using the .SetAnchor method that navigates to the specified URL when clicked, such as
anchor.SetAnchor(...some URL...);
However, all I really want the click to do is open or execute a specified file on my local Win10 machine, and this also works if I merely specify the file instead of a URL, such as
anchor.SetAnchor("notepad.exe");
The issue is that I must use iTextSharp to create many of versions of the PDF file, with each version having a different file name itself as well as a different name for the file the link opens. Although I have no problem getting this to work, the annoyance is that whenever I click the link in a new version I get a "Security Warning" popup from Windows wanting to know if the "connection" should be allowed.
Because the warning mentions a "connection" I get the feeling there may be a method something like SetAnchor that will produce a link specifically intended for opening files rather than URLs and that will not result in a Security Warning each time the name of the file the link represents is changed. If so, what is it? If not, is there some other reasonable approach to avoid the security warning? This is all being used on my local machine so I know there are no security issues with the PDFs or the files being opened.
from Recent Questions - Stack Overflow https://ift.tt/3kycn4r
https://ift.tt/eA8V8J
Comments
Post a Comment