rotativa

Rotativa - controllercontext is null

假如想象 提交于 2021-01-28 18:56:20
问题 i work with ASP.NET MVC and i try to use rotativa for build a pdf by model. The problem is that in this context i operate in a model (i can't move the code in controller), and i write a procedure into a controller for build pdf. Like this MODEL: ModelNIR modelloNIR = new ModelNIR(); modelloNIR.ufficio = Ufficio; if (r != null) { modelloNIR.ruolo = r.Descrizione.ToUpper(); //pdfFormFields.SetField("RUOLO", r.Descrizione.ToUpper()); //pdfFormFields.SetField("RUOLO2", "RUOLO " + r.Descrizione

asp.net core 3 rotativa startup.cs env problem

百般思念 提交于 2021-01-06 07:21:09
问题 Im try to use Rotativa ım follow this guide in start.cs in configure function ım add this code RotativaConfiguration.Setup(env); Severity Code Description Project File Line Suppression State Error CS1503 Argument 1: cannot convert from 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment' to 'Microsoft.AspNetCore.Hosting.IHostingEnvironment' ım search this error and find this and convert my code like this RotativaConfiguration.Setup(env.WebRootPath, "Rotativa"); and its give me this error

asp.net core 3 rotativa startup.cs env problem

折月煮酒 提交于 2021-01-06 07:21:09
问题 Im try to use Rotativa ım follow this guide in start.cs in configure function ım add this code RotativaConfiguration.Setup(env); Severity Code Description Project File Line Suppression State Error CS1503 Argument 1: cannot convert from 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment' to 'Microsoft.AspNetCore.Hosting.IHostingEnvironment' ım search this error and find this and convert my code like this RotativaConfiguration.Setup(env.WebRootPath, "Rotativa"); and its give me this error

asp.net core 3 rotativa startup.cs env problem

三世轮回 提交于 2021-01-06 07:18:26
问题 Im try to use Rotativa ım follow this guide in start.cs in configure function ım add this code RotativaConfiguration.Setup(env); Severity Code Description Project File Line Suppression State Error CS1503 Argument 1: cannot convert from 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment' to 'Microsoft.AspNetCore.Hosting.IHostingEnvironment' ım search this error and find this and convert my code like this RotativaConfiguration.Setup(env.WebRootPath, "Rotativa"); and its give me this error

Rotativa MVC not loading CSS or Images on PDF

旧时模样 提交于 2020-07-29 12:07:06
问题 I have a action which works well ( loads all images and CSS) as a normal action but when I use Rotativa.MVC.ViewAsPdf to produce a PDF it don't load the CSS. and the application doesn't show any errors public ActionResult DownloadNonProfessionalDeputy(int id) { Application_Attorney_NonProfessional oAP = db.Application_Attorney_NonProfessional.Find(id); return new Rotativa.MVC.ViewAsPdf(oAP) { FileName = string.Format("DCM_Attorney_Non_Professional_Application.pdf", new { CustomSwitches = "-

Rotativa generated PDF not respecting UIkit grid

痞子三分冷 提交于 2020-06-17 14:46:48
问题 I want to generate a PDF from an specified view respecting my actual CSS. <html> <head> <meta charset="utf-8" /> <style> .justify { text-align: justify; text-rendering: geometricPrecision; } .center { text-align: center; } body { font-size: 15px; white-space: normal; line-height: 110%; text-rendering: geometricPrecision; } .rightheader { font-size: 12px; } .bigger{ font-size:18px; } </style> <link href="~/Content/uikit.css" rel="stylesheet" /> <link href="~/Content/CartaSates.css" rel=

BuildFile Error In Rotativa.aspnetcore

纵然是瞬间 提交于 2020-05-13 05:38:50
问题 While converting a view as pdf in asp.net core 2.1 app with rotative it gives an error Value cannot be null. Parameter name: path1 Below is my Code var rpt = new ViewAsPdf(); //rptLandscape.Model = Model; rpt.PageOrientation = Rotativa.AspNetCore.Options.Orientation.Landscape; rpt.PageSize = Rotativa.AspNetCore.Options.Size.A4; rpt.ViewName = "Test"; byte[] arr = await rpt.BuildFile(actionContextAccessor.ActionContext); System.IO.File.WriteAllBytes(Path.Combine(env.WebRootPath, "PDFStorage",

How to save Rotativa PDF on server

本秂侑毒 提交于 2020-01-21 01:41:28
问题 I am using Rotativa to generate PDF in my "MVC" application. How can I save Rotativa PDF? I need to save the document on a server after all the process is completed. Code below: public ActionResult PRVRequestPdf(string refnum,string emid) { var prv = functions.getprvrequest(refnum, emid); return View(prv); } public ActionResult PDFPRVRequest() { var prv = Session["PRV"] as PRVRequestModel; byte[] pdfByteArray = Rotativa.WkhtmltopdfDriver.ConvertHtml("Rotativa", "Approver", "PRVRequestPdf");

mvc action not being called from Rotativa PartialViewAsPdf

浪子不回头ぞ 提交于 2020-01-06 19:33:38
问题 I am using Rotativa (version 1.6.3) to generate pdf from my view. I have a simple partial view(_OverallResultPrintVersion.cshtml): @Styles.Render("~/bundles/css") <img src="@Url.Action("DrawChart", "Vote", new {area = "Award"})"/> In my action when returning Rotativa PartialViewAsPdf, it opens an empty pdf page and the "DrawChart" action won't be called as expected. Here is how I implemented My actions in Vote controller: public ActionResult OverallResultPdf() { return new Rotativa

PDF thrown to browser console, not downloading

回眸只為那壹抹淺笑 提交于 2020-01-05 06:04:44
问题 I'm using Rotativa to generate a PDF file from a view, which works well, but now on the browser I get the raw file thrown at the console, no download dialog box, no warning, nothing. Here's my code: Controller public ActionResult DescargarPDF (int itemId) { var presupuesto = ReglasNegocio.Fachada.Consultas.ObtenerPresupuesto(itemId); return new Rotativa.PartialViewAsPdf("_PresupuestoFinal", presupuesto) { FileName = "Presupuesto_" + itemId + ".pdf", PageSize = Rotativa.Options.Size.A4 }; }