user2622220
user2622220

Reputation: 185

Rotativa pdf does not work on server

I am using Rotativa to generate a pdf of my view. on my local computer this works. On my online server, it says cannot locate file or directory. It is probably a permission problem. Any idea how to fix it?

Thanx in advance

Upvotes: 0

Views: 11406

Answers (4)

Srinivas Mankala
Srinivas Mankala

Reputation: 1

We had the same issue on a windows server. Found out that Reports is used by sql server reporting services. So we just had to rename all instances of Reports to something else in our application.

Upvotes: 0

Balan
Balan

Reputation: 421

step 1 : go to server folder where your pdf file store
step 2 : on the folder properties change security, disable read only check box and change to full control or give write control.
step 3 : In web.config change as

<system.web>   
<authentication mode="None" /> /// or bring the suitable authentication
.......................

Upvotes: 1

mike123
mike123

Reputation: 1559

Rotativa uses wkhtmltopdf at its' core, which starting from >0.12.0.0 relies on distributable VC++ lib (msvcp120.dll)

You may need to download the installer from here rather than just copy dll over to the server http://wkhtmltopdf.org/downloads.html

Simple test if server wkhtmltopdf works:

C:\[path to the wkhtmltopdf]\wkhtmltopdf.exe https://google.com test.pdf

Upvotes: 3

user2622220
user2622220

Reputation: 185

The solution was to substitute Rotativa.Mvc.ActionasPdf() with Rotativa.Mvc.ViewasPdf

public ActionResult DetailPdf(int? id)
    {
        Progetto Progetti = db.Progetti.Find(id);
        return new Rotativa.MVC.ViewAsPdf("DetailPdf", Progetti);
    }

I don't know what the problem with ActionAsPdf was though

Upvotes: 1

Related Questions