public JsonResult UplaodPdf(Mpdf _obj) { string path = ""; string filename = ""; string fname = ""; if (Request.Files.Count > 0) { if (Request.Files[0].ContentLength > 0) { HttpFileCollectionBase files = Request.Files; path = AppDomain.CurrentDomain.BaseDirectory + "Uploads/Fee_breakup/" + Session["InstituteID"].ToString(); filename = Path.GetFileName(Request.Files[0].FileName); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } else { string[] curentfiles = Directory.GetFiles(path); } HttpPostedFileBase file = files[0]; filename = DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(file.FileName); fname = Path.Combine(Server.MapPath("~/Uploads/Fee_breakup/" + Session["InstituteID"].ToString()), filename); file.SaveAs(fname); _obj.pdfpath = "Uploads/Fee_breakup/" + Session["InstituteID"].ToString() + "/" + filename; } else { _obj.pdfpath = ""; } } else { _obj.pdfpath = ""; } bool flag = false; Rpdf _objRepository = new Rpdf(); { _obj.created_ip = Request.ServerVariables["REMOTE_ADDR"].ToString(); _obj.InstituteID = Session["InstituteID"].ToString(); DataSet ds = _objRepository.UPLOAD_PDF(_obj); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { flag = true; } } } return(Json(new { flag = flag }, JsonRequestBehavior.AllowGet )); }
public DataSet UPLOAD_PDF(Mpdf _obj) { try { _cn.Open(); SqlCommand _cmd = new SqlCommand("UPLOAD_PDF", _cn); _cmd.Parameters.AddWithValue("@pdfpath", _obj.pdfpath); _cmd.Parameters.AddWithValue("@created_ip", _obj.created_ip); _cmd.Parameters.AddWithValue("@InstituteID", _obj.InstituteID); _cmd.Parameters.AddWithValue("@Filename", _obj.Filename); _cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter _adp = new SqlDataAdapter(_cmd); DataSet _ds = new DataSet(); _adp.Fill(_ds); _adp.Dispose(); _cmd.Dispose(); return(_ds); } catch (Exception) { throw; } finally { _cn.Close(); _cn.Dispose(); } }
public void PhpMain() { var mpdf = new Mpdf("", "A4", BASE_SIZE, FONT, MARGIN, MARGIN, MARGIN, MARGIN, MARGIN_HEADER, MARGIN_HEADER, PageOrientation.Portrait); mpdf.author = "Mr Compiler"; mpdf.title = "PDF title"; mpdf.subject = "PDF subject"; }