This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="file3.Default" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<script src="jquery-3.3.1.min.js"></script> | |
<body> | |
<form id="form1" runat="server"> | |
<input id="btn" type="button" class="btn btn-inf0" value="Call now" /> | |
<iframe id="if1" src="" width="400"></iframe> | |
<script> | |
$("#btn").click(function () { | |
alert("calling b5"); | |
var ua = window.navigator.userAgent; | |
var msie = ua.indexOf("MSIE "); | |
//IE | |
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer, return version number | |
{ | |
$("#if1").attr("src", "PDFGen.aspx"); | |
return; | |
} | |
//other browser | |
var request = new XMLHttpRequest(); | |
request.open("GET", "PDFGen.aspx", true); | |
request.responseType = "blob"; | |
request.onload = function (e) { | |
if (this.status === 200) { | |
var file = window.URL.createObjectURL(this.response); | |
$("#if1").attr("src", file); | |
}; | |
}; | |
request.send(); | |
return false; | |
}); | |
</script> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
namespace file3 | |
{ | |
public partial class PDFGen : System.Web.UI.Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
var bytes = System.IO.File.ReadAllBytes(Server.MapPath("~/One.pdf")); | |
Response.ContentType = "application/pdf"; | |
Response.AddHeader("Content-disposition", "inline"); | |
Response.BinaryWrite(bytes.ToArray()); | |
Response.End(); | |
} | |
} | |
} |