How to use a link label to open a pdf in a web browser ?
I have a Windows Forms application and I am making a REST service request. The response contains the URL of PDF I want to open in a web browser. Is this possible ?
I am referencing this article : http://support.microsoft.com/kb/320478
But when I change the url to request a pdf nothing happens.
Here is my code.
UrlLink.Text = "http://testurl.com/test.pdf";
UrlLink.Links.Remove(UrlLink.Links[0]);
UrlLink.Links.Add(0, UrlLink.Text.Length,
"http://testurl.com/test.pdf");
And the link label event handler:
private void UrlLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
ProcessStartInfo sInfo = new ProcessStartInfo(e.Link.LinkData.ToString());
Process.Start(sInfo);
}