public ActionResult ViewResult(int studentId)
        {
            var enrollments = db.Enrollments.Where(e => e.StudentId == studentId);
            var pdf         = new PdfResult(enrollments.ToArray(), "ViewPDFResult");

            return(pdf);
        }
Beispiel #2
0
        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);
        }
Beispiel #4
0
        public ActionResult AnalysePdf(int id)
        {
            var questionnaire = _questionnaireService.getQuestionnaireById(id);
            var pdfBytes      = _pdfService.GetPdfAnalyseFirstSurvey(questionnaire);
            var pdfResult     = new PdfResult(pdfBytes, "analyse");

            return(pdfResult);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        public ActionResult PrintBrandPriceList(int brandID)
        {
            var result = new PdfResult();

            result.BrandID = brandID;

            return(result);
        }
Beispiel #7
0
        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"));
        }
Beispiel #8
0
        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);
        }
Beispiel #10
0
        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));
            }
        }
Beispiel #11
0
        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);
            }
        }
Beispiel #12
0
 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;
 }
Beispiel #13
0
        /// <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));
            }
        }
Beispiel #14
0
        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);
        }
Beispiel #17
0
        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();
        }
Beispiel #18
0
        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);
        }
Beispiel #19
0
        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);
        }