How to display pdf files from the database using angularjs in html
I'm not getting any error on the browser console, my whole browser page is white and empty.
$http.get("http://localhost:49556/api/purchaseOrder/getEmpImages", { responseType: 'arraybuffer' })
.then(function (response) {
var file = new Blob([response], { type: 'application/pdf' });
var fileURL = URL.createObjectURL(file);
$scope.content = $sce.trustAsResourceUrl(fileURL);
})
<form name="cntrl.Form1" role="form" enctype="multipart/form-data">
<embed ng-src="{{content}}" style="width:200px;height:200px;"></embed>
</form>
[HttpGet]
[ActionName("getEmpImages")]
public string getEmpImages()
{
SqlConnection myConnection = new SqlConnection();
myConnection.ConnectionString = ConfigurationManager.ConnectionStrings["ERPConnectionStringI"].ConnectionString;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.CommandText = "GET_PURCHASE_INVOICE_DOC";
sqlCmd.Connection = myConnection;
//sqlCmd.Parameters.AddWithValue("@Parameter", Parameter);
SqlDataAdapter sda = new SqlDataAdapter(sqlCmd);
DataSet ds = new DataSet();
string jsonString = string.Empty;
myConnection.Open();
sda.Fill(ds);
myConnection.Close();
jsonString = JsonConvert.SerializeObject(ds.Tables[0]);
return jsonString;
}