Open PDF in a new tab in browser
Your tags indicate asp.net-mvc.
Create a controller to handle requests for the PDF file
Pseudo:
[RoutePrefix("Pdf")]
public class PdfController : Controller {
[Route("{id}"]
public ActionResult GetPDF(int id) {
//...Code to extract pdf from SQLServer and store in stream
Stream stream = GetDataFromSQLServerById(id);
return File(stream,"filename.pdf");
}
}
On client
<a href="/Pdf/123456" target="_blank">
<img src="images/pdficon.jpg">
</a>
Update:
Referencing @ChrisPratt's comment; (which I forgot to include in my answer)
The target
attribute on the anchor tag is what will tell the browser to open the link in a new tab.