|
Rank: Newbie Groups: Member
Joined: 7/9/2013 Posts: 2
|
Hi All, I am having some trouble with an error that "should not" occur. When executing the post action I get the error: You must apply RenderAsPdfFilterAttribute to your Controller or Action method before you can call RenderAsPDF.Here is the controller code.
Code: C#
public class HomeController : Controller
{
[HttpGet]
public ActionResult Index()
{
ViewBag.ToPdf = false;
return View(new TestViewModel{ MyValue = "My header value" });
}
[HttpPost]
[ActionName("Index")]
[RenderAsPDF(AutoConvert = false)]
public ActionResult IndexPdf()
{
ViewBag.ToPdf = true;
HtmlToPdf.Options.OutputArea = new RectangleF(0f, 0.0f, PdfPageSizes.A4.Width, PdfPageSizes.A4.Height);
HtmlToPdf.Options.NoLink = true;
HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.ScaleToFit;
HtmlToPdf.Options.AutoFitY = HtmlToPdfAutoFitMode.ScaleToFit;
HtmlToPdf.Options.FooterHtmlFormat = "<strong>my footer</strong>";
HtmlToPdf.Options.FooterHtmlPosition = 11f;
MVCToPDF.RenderAsPDF();
return View("Index",new TestViewModel { MyValue = "My header value" });
}
}
So there is an attribute that’s marks the action to be rendered as PDF, but it’s not recognized. Is there something else that I need to do to get this working? Regards, André
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
That might be a problem on our side. Can you isolate the problem into a test project and send the test project to us?
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/9/2013 Posts: 2
|
Hi,
Yes, I have a zip with the solution. Do you have an emailaddress so I can send it?
André
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
We have posted a new build (EO.Total 2013.0.15) on our download page that should fix this problem.
Thanks!
|
|