public ActionResult ViewResult(int studentId) { var enrollments = db.Enrollments.Where(e => e.StudentId == studentId); var pdf = new PdfResult(enrollments.ToArray(), "ViewPDFResult"); return(pdf); }
public ActionResult download() { PaymentInvoice tempinvoice = new PaymentInvoice().GetInvoice(Request.QueryString["tid"].ToString(), Session["companyid"].ToString(), Session["userid"].ToString()); string data = tempinvoice.invoicedata; XDocument invoicedoc = new XDocument(); try { invoicedoc = XDocument.Parse(data); } catch { } var pdf = new PdfResult(tempinvoice, "download"); string filename = "attachment; filename=" + invoicedoc.Descendants("client").First().Descendants("compname").First().Value.ToString() + "-" + invoicedoc.Descendants("metadata").First().Descendants("id").First().Value.ToString() + ".pdf"; pdf.ViewBag.Title = "Invoice"; Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", filename); return(pdf); // return View(); }
private ActionResult PDFView(PDFViewModel Pdfviewmodel) { var pdf = new PdfResult(Pdfviewmodel, "PDFView"); //return pdf; string file = pdf.ToString(); return(pdf); }
public ActionResult AnalysePdf(int id) { var questionnaire = _questionnaireService.getQuestionnaireById(id); var pdfBytes = _pdfService.GetPdfAnalyseFirstSurvey(questionnaire); var pdfResult = new PdfResult(pdfBytes, "analyse"); return(pdfResult); }
public void Constructor_WithParameters_SetsProperties() { var path = "test.txt"; var result = new PdfResult(path); Assert.Equal(PdfResult.MIMEType, result.ContentType); Assert.Equal(path, result.FileDownloadName); }
public ActionResult PrintBrandPriceList(int brandID) { var result = new PdfResult(); result.BrandID = brandID; return(result); }
public ActionResult zrobPDFAdmin() { Entities daneDoModelu = new Entities(); var SprzetUzytkownika = daneDoModelu.SprzetUzytkownika.Include(u => u.AspNetUsers); var pdf = new PdfResult(SprzetUzytkownika.ToList(), "Admin"); var view = ViewEngines.Engines.FindView(this.ControllerContext, "Admin", null); return(new RazorPDF.PdfResult(SprzetUzytkownika.ToList(), "Admin")); }
public ActionResult PdfModel() { int lastInvoiceID = getLastInvoiceID(); ViewBag.Title = "Invoice ID : " + lastInvoiceID; model.SellOrderItems = soiOp.getAlSellsOrderItemsByID(lastInvoiceID); model.SellOrder = soOp.getAlSellsOrderByID(lastInvoiceID); var pdf = new PdfResult(model, "PdfModel"); return(pdf); }
public ActionResult Pdf() { CUser cu = new CUser(); cu.userName = "******"; cu.userRoleName = "TestUser"; ViewBag.Title = "Testar PDF generering"; var pdfResult = new PdfResult(cu, "Pdf"); return(pdfResult); }
private PdfResult Execute(byte[] bytes, DateTime start) { try { var result = _extractPdf.Execute(bytes); var content = _parser.Execute(result); return(PdfResult.CreateSuccesResult(DateTime.Now.Subtract(start), content)); } catch (Exception e) { return(PdfResult.CreateErrorResult(DateTime.Now.Subtract(start), e)); } }
public ActionResult Pdf(int id = 0) { Resume applicant = db.Resumes.FirstOrDefault(r => r.ApplicantID == id); if (applicant != null) { var pdfresult = new PdfResult(applicant, "Pdf"); pdfresult.ViewBag.Title = "Resume"; return(pdfresult); } else { return(null); } }
protected ActionResult Pdf(string fileDownloadName, string viewName, object model) { // Based on View() code in Controller base class from MVC if (model != null) { ViewData.Model = model; } PdfResult pdf = new PdfResult() { FileDownloadName = fileDownloadName, ViewName = viewName, ViewData = ViewData, TempData = TempData, ViewEngineCollection = ViewEngineCollection }; return pdf; }
/// <summary> /// Method to load the pdf, and extract the text from it. /// </summary> /// <param name="filePathToPdf">File path</param> /// <returns></returns> public PdfResult OcrPdf(string filePathToPdf) { var start = DateTime.Now; try { if (!File.Exists(filePathToPdf)) { throw new FileNotFoundException("", filePathToPdf); } return(Execute(File.ReadAllBytes(filePathToPdf), start)); } catch (Exception e) { return(PdfResult.CreateErrorResult(DateTime.Now.Subtract(start), e)); } }
protected ActionResult Pdf(string fileDownloadName, string viewName, object model) { // Based on View() code in Controller base class from MVC if (model != null) { ViewData.Model = model; } PdfResult pdf = new PdfResult() { FileDownloadName = fileDownloadName, ViewName = viewName, ViewData = ViewData, TempData = TempData, ViewEngineCollection = ViewEngineCollection }; return(pdf); }
public ActionResult Certificado(int id_curso) { _repositorio = new MeusCursosRepositorio(); IPrincipal principal = HttpContext.User; var dadosCurso = new MeusCursosViewModel(); dadosCurso = _repositorio.BuscaDadosDoCurso(id_curso.ToString(), principal.Identity.Name.ToString()); var pdfResult = new PdfResult(dadosCurso, "PDF"); pdfResult.ViewBag.title = "teste"; return(pdfResult); }
public ActionResult ReportSample() { var list = new List <Person>(); for (int i = 1; i < 10; i++) { list.Add(new Person() { UserName = "******" + i.ToString(), LuckyNumber = i }); } var pdf = new PdfResult(list, "ReportSample"); pdf.ViewBag.Title = "Report Title"; return(pdf); }
public ActionResult PDF() { PdfResult a; var users = db.Users.Include(u => u.City).Include(u => u.Company).Include(u => u.DepartmentModel); try { a = new PdfResult(users.ToList(), "PDF"); return(a); //return View(users.ToList()); } catch (Exception) { return(null); //ModelState.AddModelError(string.Empty, "Error pdf"); } ///return View(); }
public ActionResult PdfModel(string id) { // Since type is an ActionResult, we can still return an html view if something isn't right if (id != "yoda") { return(View("NotFound")); } // get Person var person = new Person(); person.UserName = id; person.LuckyNumber = 7; // pass in Model, then View name var pdf = new PdfResult(person, "PdfModel"); // Add to the view bag pdf.ViewBag.Title = "Title from ViewBag"; return(pdf); }
public object Drukuj(Context cx) { Stream s = null; foreach (Soneta.Business.Db.Attachment a in Dokument.Attachments) { if (a.Name == "test.pdf") //należy wcześniej umieścić dowolny plik wydruku nazwany test.pdf w załącznikach { s = a.SaveToStream(); break; } } var reportResult = new PdfResult { Caption = "Nazwa", Action = PdfResultAction.Print, Stream = s, //FileName = @"D:\MG\CennikREPX.pdf" //mozliwosc wykorzystania pliku PDF z dysku lokalnego }; return(reportResult); }
public ActionResult ExportToPDF(string Survey_For) { var surveyFor = Request.Form["Survey_For"]; SurveyForList surveyReportPParameterObject = new SurveyForList(); surveyReportPParameterObject.Type = "Annually"; surveyReportPParameterObject.Period = "2016"; surveyReportPParameterObject.Survey_For = surveyFor; RatingReportModel model = new RatingReportModel(); //model.IncludeRaters = includeRaters; model.ReportList = new Surveys().getSurveyForReport(surveyReportPParameterObject); var pdf = new PdfResult(model, "ExportToPDF"); pdf.ViewBag.Title = "360 DEGREE PERFORMANCE REVIEW REPORT Per Rater"; return(pdf); }