Welcome Guest Search | Active Topics | Sign In | Register

You must apply RenderAsPdfFilterAttribute to your Controller or Action method before you can call RenderAsPDF. Options
Aptido
Posted: Tuesday, July 9, 2013 6:18:15 AM
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é
eo_support
Posted: Tuesday, July 9, 2013 7:59:43 AM
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!
Aptido
Posted: Wednesday, July 10, 2013 10:19:39 AM
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é
eo_support
Posted: Thursday, July 11, 2013 11:59:56 AM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.