Esempio n. 1
0
        public ActionResult Impressao()
        {
            VagasCompleto vagas = new VagasCompleto();
            var           pdf   = new Rotativa.AspNetCore.ViewAsPdf(vagas.Listar());

            return(pdf);
        }
Esempio n. 2
0
        public async Task <byte[]> GeraReportLevantamentoPredial(ReportEndemiasViewModel model, int tipo)
        {
            var httpContext = new DefaultHttpContext {
                RequestServices = _service
            };
            var actionContext = new ActionContext(httpContext, new RouteData(), new ActionDescriptor());

            string caminhobd = string.Empty;

            if (tipo == 0)
            {
                caminhobd = "Report/Endemias/ReportLevPredialAnalitico";
            }
            else
            {
                caminhobd = "Report/Endemias/ReportLevPredialSintetico";
            }

            var bytePDF = new Rotativa.AspNetCore.ViewAsPdf(caminhobd, model)
            {
                PageOrientation = Orientation.Landscape,
                PageMargins     = { Top = 8, Right = 8, Bottom = 8, Left = 8 },
                FileName        = string.Concat("ReportLevantamentoPredial", ".pdf"),
                CustomSwitches  = "--footer-center \"| RG System - Tecnologia em Software! (27) 3150-9770 - www.rgsystem.com.br | Página [page] de [toPage] |\"" + " --footer-font-size \"9\" --footer-font-name \"calibri light\""
            }.BuildFile(actionContext);

            return(await bytePDF);
        }
        public ActionResult PrintAdoptionSlip(int id)
        {
            //  var emp = _context.Adocao.Where(e => e.AdocaoId == id).First();
            var adocao = _context.Adocao
                         .Include(a => a.Animal)
                         .Include(a => a.EstadoAdocao)
                         .Include(a => a.Utilizador)
                         .Where(m => m.AdocaoId == id).First();

            var report = new Rotativa.AspNetCore.ViewAsPdf("IndexById", adocao);

            return(report);
        }
        public async Task <IActionResult> Index()
        {
            var pdf = new Rotativa.AspNetCore.ViewAsPdf("Index")
            {
                FileName        = "C:\\Test.pdf",
                PageSize        = Rotativa.AspNetCore.Options.Size.A4,
                PageOrientation = Rotativa.AspNetCore.Options.Orientation.Portrait,
                PageHeight      = 20,
            };

            var byteArray = await pdf.BuildFile(ControllerContext);

            return(File(byteArray, "application/pdf"));
        }
Esempio n. 5
0
        public async Task <byte[]> GeraReportCartaoVacina(CartaoVacinaReportViewModel model)
        {
            var httpContext = new DefaultHttpContext {
                RequestServices = _service
            };
            var actionContext = new ActionContext(httpContext, new RouteData(), new ActionDescriptor());

            var bytePDF = new Rotativa.AspNetCore.ViewAsPdf("Report/Imunobiologico/ReportCartaoVacina", model)
            {
                PageOrientation = Orientation.Portrait,
                PageMargins     = { Top = 8, Right = 8, Bottom = 8, Left = 8 },
                FileName        = string.Concat("ReportCartaoVacina", ".pdf"),
                CustomSwitches  = "--footer-center \"| RG System - Tecnologia em Software! (27) 3150-9770 - www.rgsystem.com.br | Página [page] de [toPage] |\"" + " --footer-font-size \"9\" --footer-font-name \"calibri light\""
            }.BuildFile(actionContext);

            return(await bytePDF);
        }
Esempio n. 6
0
        public static List <EmailAttachment> PreparePdfFile <T>(T model, string viewName, string fileName, ActionContext context)
        {
            var pdfAsBytes = new Rotativa.AspNetCore
                             .ViewAsPdf(viewName, model)
                             .BuildFile(context)
                             .GetAwaiter()
                             .GetResult();

            var pdfAsEmailAttachment = new EmailAttachment()
            {
                Content  = pdfAsBytes,
                FileName = fileName,
                MimeType = GlobalConstants.PdfMimeType,
            };

            var emailAttachments = new List <EmailAttachment>()
            {
                pdfAsEmailAttachment
            };

            return(emailAttachments);
        }