vb.net - Force a webbrowser to display a PDF file only on Adobe Acrobat Reader -
i create pdf itextsharp , show preview of pdf inside webbrowser control. preview user can save or print using defaults adobe reader's buttons
working on windows x64 bits adobe reader default pdf viewer works fine.
the same program on windows x64 bits foxit reader default pdf open file on foxit reader on full application window, outside program.
i need manage that.
my code like
dim pathtopdf string pathtopdf = directoryofmyapp & "\reportpreview.pdf" reportpreviewwebbrowser.navigate(pathtopdf) where directoryofmyapp gets c: or d: letter of hard disk.
i read link how start adobe reader or acrobat vb.net?
but line like
reportpreviewwebbrowser.navigate("acrobat", pathtopdf ) didn´t work , think webbrowser control don´t have option choose pdf viewer
https://msdn.microsoft.com/es-es/library/system.windows.forms.webbrowser(v=vs.110).aspx
is there way set webbrowser use adobe acrobat reader or force other pdf viewer show pdf inside webbrowser control?
i agree zaggler on comments on this. making assumptions @ point on software installed on end user's computer. unless going make application's pdf viewer part of dependency installation or cooked .net cannot guarantee have program use. nor can guarantee it's installed location.
however there cheap hack windows based processes can in vb.net. can use ole system.diagnostics.process()
sub main() dim nprocess = new system.diagnostics.process() nprocess.start($"d:\pdffile.pdf") end sub in example did quick file location, can try ensure valid location not change or in app's running process folder. low tech far development goes, saying: "run me process, process, @ location. don't care is, use windows defaults determine it."
so when run on windows 10 dev box loads edge display it, @ home fire adobe viewer. opening file os's choice of using file extension. not glamorous or hardened code works when want quick happen.
Comments
Post a Comment