Having some issues with rendering using the MVC views
If I leave the X-Pdf-Render header in place, I get a blank PDF.
If I remove the X-Pdf-Render header and change the content type to text/xml, the xml renders correctly
If I remove the X-Pdf-Render header and change the content type to text/xsl, I get "error on line x at column y: Extra content at the end of the document"
This happens with any of the included example views (PdfMvcExample.cshtml etc).
I've checked web.config, both keys exist.
Given that this is happening with any template, I'm thinking it might be an environment issue?
Having spent a bit more time on this, I might be getting closer to solving it:
Outputting as xsl renders all the correct content, but with the error. Saving the page and opening in notepad++ shows the expected xml output, with the addition of 81000 (yup, 81k) NUL characters following the element.
No idea where they'd be coming from or how to tidy 'em up, but that's cause of the error.
We were using route hijacking to perform some filtering on the model before rendering - this was simply overriding the Index() method, so all requests for the page were passing through the controller regardless of template (at least, that's my understanding of how it works).
I've changed the controller action to explicitly reference the non-pdf template (ie only hijacking the route for the default template) and all is working fine.
Extra content at the end of the document error
Having some issues with rendering using the MVC views
This happens with any of the included example views (PdfMvcExample.cshtml etc).
I've checked web.config, both keys exist.
Given that this is happening with any template, I'm thinking it might be an environment issue?
Hi Nathan, could you post a blink to your blank PDF?
Does the PDF contain the metadata that is set by the example view?
Does the node that you are rendering against contain content for the document type properties that are used the the example templates?
What happens if you hardcode some text into the example templates?
Many Thanks.
Hi Darren
Will check metadata and send a copy of the PDF when I'm back in the office.
Node definitely has the properties, and the same happens if I try to render a static string - can output xml but get an error with xsl.
Hi Darren
Generated pdf is here: https://www.dropbox.com/s/ko5pbjk0e6ny4i6/bachelor-of-arts.pdf?dl=0
It does contain the metadata set by the view, just no content. Have tried @PdfHelper.Block("my text") and it throws the same error...
Having spent a bit more time on this, I might be getting closer to solving it:
Outputting as xsl renders all the correct content, but with the error. Saving the page and opening in notepad++ shows the expected xml output, with the addition of 81000 (yup, 81k) NUL characters following the element.
No idea where they'd be coming from or how to tidy 'em up, but that's cause of the error.
Annnnnnnd we have a solution.
We were using route hijacking to perform some filtering on the model before rendering - this was simply overriding the Index() method, so all requests for the page were passing through the controller regardless of template (at least, that's my understanding of how it works).
I've changed the controller action to explicitly reference the non-pdf template (ie only hijacking the route for the default template) and all is working fine.
Awesome glad to hear you worked it out! Sorry, I was out and about yesterday.
is working on a reply...