I am using Rotativa ActionasPDF() to generate a pdf from a view in my MVC4 project. It works flawlessly on my local instance, but I just copied the entire solution to my server and it does not work. I get the error "The system cannot find the file specified", but I'm not sure what file it is talking about. I assume it is talking about the Rotativa dll, but I've got the generated Rotativa folder on my server as well. The solution is an exact duplicate as my local copy. My site is hosted on IIS 8, windows 2012 server. Research has told me I could have a permissions issue with some folder, but I'm not sure which ones they would be. I just set all my controller & views to 777 permissions for the time being. No luck. Any ideas to what I'm missing, or how I can make sure the dll is registered on my server?
Here is my controller action method:
public ActionResult DownloadFile(int id = 0)
{
var filename = string.Format("Invoice{0}.pdf", id);
return new ActionAsPdf("Invoice" + "/" + id, new { name = "Invoice" + id }) { FileName = filename, PageSize = Size.Letter, PageOrientation = Orientation.Portrait, PageMargins = new Margins(0, 0, 0, 0) };
}
Check if you add all files in rotativa directory on server-
libeay32.dll
wkhtmltopdf.exe
etc.
Old thread but I had the same issue so I wanted to share the solution for people searching in the future.
Ensure you have the correct VS Redistributable installed on the server, or files in the Rotativa folder.
Use the server IP address instead of the DNS name. I do not know why this works but will edit this if I figure it out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With