mvcrazortopdf

MvcRazorToPdf - images not rendering, MVC4

一世执手 提交于 2019-12-22 14:47:13
问题 I have been trying to render an image but with no positive result. Is there anything specific I need to add to make it work. I am not including the rest of the View which renders fine, but in the pdf, the image is missing. I have followed the below link: https://github.com/andyhutch77/MvcRazorToPdf View @model Test.Models.PdfExample @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; var imagePath = Server.MapPath("~/Content/Images"); } <div style="width: 200%; height: 80px;

MVCRazorToPDF save PDF to location or Blob and then download

↘锁芯ラ 提交于 2019-12-11 11:27:45
问题 Below is my code : public class ActionDownloadAttribute : ActionFilterAttribute { public override void OnResultExecuted(ResultExecutedContext filterContext) { filterContext.HttpContext.Response.AddHeader("content-disposition", "attachment; filename=" + "Report.pdf"); base.OnResultExecuted(filterContext); } } [ActionDownload] public ActionResult GeneratePdf() { List<Comment> comments = null; using (var db = new CandidateEntities()) { comments = db.Comments.ToList(); } return new

MVCRazorToPdf (iTextSharp) using custom font

本秂侑毒 提交于 2019-12-10 19:37:20
问题 I am trying to add a custom font to my pdf output using the nuget package MVCRazorToPdf but I am having trouble with how to do this as the documentation for iTextSharp isn't great and all seems to be outdated. The current code I have for creating the pdf is: return new PdfActionResult( "test.cshtml", new TestModel(), (writer, document) => { FontFactory.Register(HostingEnvironment.MapPath("~/content/fonts/vegur-regular-webfont.ttf"), "VegurRegular"); }); Where writer is a PdfWriter and

MvcRazorToPdf - images not rendering, MVC4

不羁的心 提交于 2019-12-06 06:03:23
I have been trying to render an image but with no positive result. Is there anything specific I need to add to make it work. I am not including the rest of the View which renders fine, but in the pdf, the image is missing. I have followed the below link: https://github.com/andyhutch77/MvcRazorToPdf View @model Test.Models.PdfExample @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; var imagePath = Server.MapPath("~/Content/Images"); } <div style="width: 200%; height: 80px;"> <div> <img alt="Test123" src="@imagePath\image.jpg" /> // not rendering @*<img alt="Test123" src="