开发者

Download Acrobat reader on user choice in windows installer

开发者 https://www.devze.com 2023-02-21 14:30 出处:网络
I want to download Adobe Acrobat Reader when user selects the option to download it in the Windows Installer Setup screen. I created a dialog for screen. Now, when user 开发者_Go百科selects the checkb

I want to download Adobe Acrobat Reader when user selects the option to download it in the Windows Installer Setup screen. I created a dialog for screen. Now, when user 开发者_Go百科selects the checkbox, this download should start automatically. I have to write code for this in the installer class.


In general, find the page on www.adobe.com where you can download the requested exe. Than, in your code, use WebRequest to download the page, use Html Agility (to simplify your task) to extract the link to the EXE to download, finally download the exe using:

try
{
     WebRequest req = WebRequest.Create("[URL here]");
     WebResponse response = req.GetResponse();
     Stream stream = response.GetResponseStream();
     //...
}
catch (Exception)
{
     MessageBox.Show("There was a problem downloading the file");
}

For example, for my OS and language, this is the EXE link.


Either include the Acrobat Reader in your installation (its installer; I'm quite sure its license allows you to do so) and install it if required or don't bundle nor install it. Don't try to do a direct download from any third party site as this might violate their TOS. For the easiest solution, present the user with an option to open the default download page in case they're missing the requirement (in this case the Reader). I'd guess it's for your user manual or whatever to show? In that case I'd just include a note on the "setup finished" page or in the manual component's name (e.g. "User manual (requires a PDF reader)") to indicate that the document can't be opened without an additional program. Another alternative would be to use another format that can be understood without third party tools, e.g. a HTML, CHM or RTF file.

0

精彩评论

暂无评论...
验证码 换一张
取 消