I want to open pdf file in new tab and visualize it.
This is my code :
SPLinkButton linkHelp = new SPLinkButton();
linkHelp.Text = "HELP...";
linkHelp.Target = "_blank";
linkHelp.Click += new EventHandler(linkHelp_Click);
This is my button event:
void linkHelp_Click(object sender, EventArgs e)
{
string path = @"http://sf-spsdev02/TestSite/Shared%20Documents/UserGiude-WayBill.pdf";
WebClient client = new WebClient();
Byte[] buffer = client.DownloadData(path);
if (buffer != null)
{
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("content-length", buffer.Length.ToString());
HttpContext.Current.Response.BinaryWrite(buffer);
}
}
This is a error:
With hyperLink This code download the file(with IE)... I want Open a file in new tab... this is possible with IE Edge.., How to do this with IE ?
HyperLink href = new HyperLink();
href.NavigateUrl = "http://sf-spsdev02/TestSite/Shared%20Documents/UserGiude-WayBill%20System.pdf";
href.Text = "Помощ...";
href.Target = "_blank";