Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotativa file not found on server only

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) };
    }

enter image description here

like image 523
C.Coggins Avatar asked Feb 10 '15 14:02

C.Coggins


2 Answers

Check if you add all files in rotativa directory on server-

libeay32.dll

wkhtmltopdf.exe

etc.

like image 52
Zvi Redler Avatar answered Jan 02 '23 12:01

Zvi Redler


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.

like image 37
Mike Sutley Avatar answered Jan 02 '23 13:01

Mike Sutley