Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make BuildFile work without a controller context #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JustMaier
Copy link

I've been using this project for a few years now and more than once I've had to modify it to remove the dependency on ControllerContext so that I could create PDFs in WebAPI and outside of a normal MVC Controller. ControllerContext in most cases was replaceable by HttpContext.Current.

To perform the tests I had to update the demo and the unit tests to MVC 5. After the update all of the tests passed successfully.

@JustMaier JustMaier mentioned this pull request Apr 2, 2015
@viktor-nikolaev
Copy link

Like it, thanks

@2E0PGS
Copy link

2E0PGS commented Aug 1, 2018

Great work. A few indenting issues or maybe thats just Github doing that on it's preview of the diffs. Hopefully this gets merged soon as its been sat around a while.

@2E0PGS
Copy link

2E0PGS commented Aug 2, 2018

I tried building your branch and it seems to break refences to Mvc framework. The current master of Rotativa works fine however and builds.

See error list:
image

@2E0PGS
Copy link

2E0PGS commented Aug 2, 2018

Never mind those references are broken before your commits. I think I may try cherry picking your changes onto latest stable.

@2E0PGS
Copy link

2E0PGS commented Aug 2, 2018

Did this ever actually work for you? I have built a new version with your patches ontop of current master branch of this repo. I havn't pushed the code yet due to login logistics on the machine I need to figureout.

I got a custom DLL compiled for dotnet framework 4.5 and it all works besides when it goes to call foo.BuildPdf(); or foo.BuildFile(); in my controller.

I get a framework error as it gets further down the stack:

"message": "An error has occurred.",
	"exceptionMessage": "Value cannot be null.\r\nParameter name: controllerContext",
	"exceptionType": "System.ArgumentNullException",
	"stackTrace": "   at System.Web.Mvc.ViewEngineCollection.FindView(ControllerContext controllerContext, String viewName, String masterName)\r\n   at Rotativa.ViewAsPdf.GetView(ControllerContext context, String viewName, String masterName)\r\n   at Rotativa.ViewAsPdf.CallTheDriver(ControllerContext context)\r\n   at Rotativa.AsResultBase.BuildFile(ControllerContext context)\r\n   at 

@JustMaier
Copy link
Author

@2E0PGS It did work for me years ago when I used this. I haven't used this since mid-2015, so I'm not sure about its current state. Sorry.

@2E0PGS
Copy link

2E0PGS commented Aug 10, 2018 via email

@jbinder
Copy link

jbinder commented Apr 11, 2019

@2E0PGS Could you please share the class?

@2E0PGS
Copy link

2E0PGS commented Apr 11, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants