The non-helper based templates work fine, but when I try to use the helper template I have two problems
The template includes '@using PdfHelper' which will not compile. I can take it out and then i can un the website in debug mode, but
If I remove the '@using PdfHelper' line I get an 'Object reference not set to an instance of an object' Error tied to the first call of the helper methods:
<!--
Enabling request validation in view pages would cause validation to occur
after the input has already been processed by the controller. By default
MVC performs request validation before a controller processes the input.
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
PdfMvcHelperExample.cshtml resulting in 'Object reference not set to an instance of an object 'Error
Hi
I have installed PDF Creator on UaaS, and I am able to create PDF documents using the old-style .master templates.
I would however like to use a .cshtml template and have hence found the Example-MVC-templates-for-PDF-Creator.zip file at: http://our.umbraco.org/FileDownload?id=7068
The non-helper based templates work fine, but when I try to use the helper template I have two problems
The template includes '@using PdfHelper' which will not compile. I can take it out and then i can un the website in debug mode, but
If I remove the '@using PdfHelper' line I get an 'Object reference not set to an instance of an object' Error tied to the first call of the helper methods:
Any ideas?
Hi Andreas,
To me it looks like the web.config in your /Views folder doesn't contain the references required to access @Html...
Could you post that file? and I'll compare to my working example.
Thanks.
Sure:
This looks like the web.config from the root of your application - i need to take a look at the one in the Views folder.
Sorry, here it is:
Could you try add:
@using System.Web.Mvc
To the top of the file.
Thanks. Darren.
Hi Darren
Thanks, whis may be part of the solution, but there are still a couple of issues.
I no longer seem to have access to the @Model object - which is not critical to me.
I seem to get the same error (see below) everytime @Html.Raw is used:
Best regards, Andreas
Hi Andreas - Could you post the whole stack trace please. I'm on holiday/vacation this week, so my response may not be so prompt.
Hi Darren
Sure, here it is:
Could you send me your PdfHelper.cshtml to my email address darren at moriyama.co.uk?
is working on a reply...