rotativa

How to display page breaks in PDF generated by Rotativa

ぐ巨炮叔叔 提交于 2019-12-03 05:16:09
In my ASP.NET MVC 4 app, I have an index view that has several partial views embedded in it. I installed latest version 1.6.1 of Rotativa via NuGet. Now I can print the index page to a PDF using Rotativa. I would like to have a page break in the PDF after every partial view. How can this be achieved using Rotativa? I tried to follow this example to use CustomSwitches but there does not seem to be one for page break. I used this article to generate the PDF Eric Brown - Cal If you are using 1.6.1 you can just add the page breaks in the CSS (this does not work consistently in 1.5.0, I have not

session become null in controller method

让人想犯罪 __ 提交于 2019-12-02 06:29:04
问题 I have following controller , in that controller I created session to save IENUMERABLE data-set [HttpPost] [ValidateInput(false)] public ActionResult Create_Brochure(IEnumerable<ProductsPropertiesVM> model) { IEnumerable<ProductsPropertiesVM> newmodel = model; IEnumerable<BrochureTemplateProperties> sample = model.Where..... Session["TemplateData"] = newmodel; return View(sample); } EDIT: Create_Brchure View page has href link to call PrintIndex method in same class file <a href="@Url.Action(

Save PDF file as a byte array or stream using Rotativa

依然范特西╮ 提交于 2019-12-01 23:06:41
问题 I'm trying to convert html to a PDF using Rotativa but I want to save at as a byte array or a stream so I can easily attach it to a mail or something. I found a solution here but the file can't be opened by any PDF reader because it's not a supported format or the file is corrupted. Here is another solution from the same thread but I can't figure out what is the required parameters to pass to this function and I couldn't find any documentation for Rotativa online. 回答1: I found the solution

Rotativa PDF generation working locally but not on IIS 7

爱⌒轻易说出口 提交于 2019-11-30 04:15:58
I have an ASP.NET MVC 5 application. It has a simple form and when the user submits it, the form is stored in the cache and then another controller action is called, this action will return the model as a view as a PDF. I have no need to save it locally, just to show it in the browser so that the user can download it. There is no need for a database either, that is why I store the model in the cache. Locally, on Visual studio 2013, it works fine. But when I publish it to IIS 7 I get an Unhandled Execution Error . Here is the stack trace that I get back: Unhandled Execution Error Description:

Displaying headers and footers in a PDF generated by Rotativa

筅森魡賤 提交于 2019-11-29 04:37:53
I'm trying to specify headers and footers in a PDF generated by Rotativa library. As the author answered here it should be possible using CSS (described here ). However, I'm not able to do this. I have a stylesheet loaded in the meta tag: <link href="print.css" rel="stylesheet" type="text/css" media="print" /> And in the stylesheet at the bottom: @page { @top-left { content: "TOP SECRET"; color: red } @bottom-right { content: counter(page); font-style: italic } } And then generating PDF by: public ActionResult ShowPdf() { var model = new Model(); return new ViewAsPdf("view.cshtml", model) {

Why does Rotativa always generate my login page? Why is it slow?

空扰寡人 提交于 2019-11-28 23:31:56
I was using this Rotativa 1.6.4 code example to generate a PDF from a page in my .NET MVC 5 app. public ActionResult PrintIndex() { var a = new ActionAsPdf("Index", new { name = "Giorgio" }) { FileName = "Test.pdf" }; a.Cookies = Request.Cookies.AllKeys.ToDictionary(k => k, k => Request.Cookies[k].Value); a.FormsAuthenticationCookieName = System.Web.Security.FormsAuthentication.FormsCookieName; a.CustomSwitches = "--load-error-handling ignore"; return a; } public ActionResult Index(string name) { ViewBag.Message = string.Format("Hello {0} to ASP.NET MVC!", name); return View(); } It was not

I am using Rotativa tool to display pdf. It works fine on localhost, But does not work on Azure platform

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 12:54:48
I am using Rotativa tool to display PDF. It works fine on localhost , But does not work on Azure platform. Below is my code... public ActionResult GeneratePDF(int id = 0) { ReportTransactionData reporttransactiondata = db.ReportTransactionDatas.Find(id); var viewFileToPrint = @"~/Views/ReportTranData/PDFReport.cshtml"; //var oRotativaPDF = new Rotativa.ViewAsPdf(); var oRotativaPDF = new Rotativa.PartialViewAsPdf(); try { if (reporttransactiondata == null) { return HttpNotFound(); } else { // Populate reporttransactiondata with Verfier Name...TO BE IMPLEMENTED LATER... //reporttransactiondata

How do I intercept the output stream of the current actionresult in .NET MVC3?

老子叫甜甜 提交于 2019-11-28 12:32:01
Hi and thanks for looking! Background I am using the Rotativa pdf tool to read a view (html) into a PDF. It works great, but it does not natively offer a way to save the PDF to a file system. Rather, it only returns the file to the user's browser as a result of the action. Here is what that code looks like: public ActionResult PrintQuote(FormCollection fc) { int revisionId = Int32.Parse(Request.QueryString["RevisionId"]); var pdf = new ActionAsPdf( "Quote", new { revisionId = revisionId }) { FileName = "Quote--" + revisionId.ToString() + ".pdf", PageSize = Rotativa.Options.Size.Letter };

Error converting MVC4 view to PDF with Rotativa or RazorPDF

安稳与你 提交于 2019-11-28 10:48:02
问题 I am trying to convert a MVC4 view to Pdf. after a few minutes searching I found https://www.nuget.org/packages/Rotativa/ and https://www.nuget.org/packages/RazorPDF both give me the same problem that will be explained below: I installed Rotativa 1.6.1 via nuget in a Mvc4 project. my example action method looks like this: [HttpGet] public ViewAsPdf TestPdf() { return new ViewAsPdf("TestPdf"); } my example view is structured in the following manner: @{ Layout = null; } <!DOCTYPE html> <html>

Displaying headers and footers in a PDF generated by Rotativa

蓝咒 提交于 2019-11-27 18:42:26
问题 I'm trying to specify headers and footers in a PDF generated by Rotativa library. As the author answered here it should be possible using CSS (described here). However, I'm not able to do this. I have a stylesheet loaded in the meta tag: <link href="print.css" rel="stylesheet" type="text/css" media="print" /> And in the stylesheet at the bottom: @page { @top-left { content: "TOP SECRET"; color: red } @bottom-right { content: counter(page); font-style: italic } } And then generating PDF by: