how print image in mvc
don't display image what should i do?
public ActionResult DownloadPDF(int id)
{
// int id =Convert.ToInt32(fc["id"]);
DataSet ds = new DataSet();
pishroZamanV2Entities db = new pishroZamanV2Entities();
string constr = ConfigurationManager.ConnectionStrings["pishroZamanV2"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
var courseRegister = @"select tblcourseRegister.id,courseFinishDate,courseStartDate,fname,lname,nationalCode,PersonalPic,name from tblcourseRegister left join tblcourse on tblcourseRegister.idCourse=tblcourse.id where tblcourseRegister.id="+id;
using (SqlCommand cmd = new SqlCommand(courseRegister))
{
cmd.Connection = con;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
sda.Fill(ds);
}
}
}
DataTable dt = ds.Tables[0];
try
{
var model = new GeneratePDFModel();
string a = @"<link href='~/assets/panel/vendor/fontawesome-free/css/all.min.css' rel='stylesheet' type='text/css'> <div class='container' style='border: 6px solid #cd6133; padding: 2%;text-align: center;background-color:white;margin-top: 5%;border-radius: 16px;'>
<div>
<img src = '~/uploads/pryhervfLOGO2.png' style = 'float:right;' />
<img src='~/uploads/" + dt.Rows[0]["PersonalPic"] +@" 'style='float:left; width: 100px; ' />
</div> <br/>
<h1 style = 'font-size: 20px; color: #227093' >
<i class='fa fa-certificate' style='color: #cd6133'></i>
گواهینامه پیشرو زمان
</h1>
<h2 style = 'font-size: 20px; text-transform: uppercase;' ><span> بدین وسیله گواهی میشود آقا/خانم</span><span id = 'dname' > "+
dt.Rows[0]["fname"]+' '+ dt.Rows[0]["lname"]
+@"
</span></h2>
<span>دارای کد ملی</span><span>"+
dt.Rows[0]["nationalCode"]
+@"
</span><span> دوره آموزشی </span><span>"+
dt.Rows[0]["name"]
+ @"
</span>
<span>از تاریخ</span> <span>" +
@pishroZamanV2.iclass.dateAndTime.UnixTimeStampToDateTime((long) dt.Rows[0]["courseStartDate"])
+ @"
</span> <span>تا</span> <span>" +
@pishroZamanV2.iclass.dateAndTime.UnixTimeStampToDateTime((long)dt.Rows[0]["courseFinishDate"])
+ @"
</span> <span>با موفقیت کامل به پایان رسانیده است.</span>
</div>";
//get the information to display in pdf from database
//for the time
//Hard coding values are here, these are the content to display in pdf
var content = a;
var logoFile = @"/uploads/pryhervfLOGO2.png";
model.PDFContent = content;
model.PDFLogo = Server.MapPath(logoFile);
//Use ViewAsPdf Class to generate pdf using GeneratePDF.cshtml view
return new Rotativa.ViewAsPdf("GeneratePDF", model) { FileName = "firstPdf.pdf" };
}
catch (Exception ex)
{
throw;
}
}
<div>
<a href="@Url.Action("DownloadPDF", "admin", new { id =@row["id"] })">چاپ گواهینامه</a>
</div>