Rotativa file not found on server only
Asked Answered
T

4

6

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

Tonguelash answered 10/2, 2015 at 14:25 Comment(1)
Possible duplicate of Rotativa PDF generation working locally but not on IIS 7Collectivity
M
1

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

libeay32.dll

wkhtmltopdf.exe

etc.

Myrmecology answered 10/10, 2016 at 12:44 Comment(0)
D
1

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.

Disk answered 20/11, 2017 at 20:20 Comment(0)
M
0

You need to have Visual C++ Redistributable Packages on the server. You can download the packages from here: http://www.microsoft.com/en-gb/download/details.aspx?id=40784

Microscopy answered 5/3, 2015 at 10:21 Comment(0)
A
-1

You need update Rotativa, Rotativa.Core, Rotativa.MVC in Nuget

Ayesha answered 20/11, 2018 at 14:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.