0

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

user2622220
  • 185
  • 1
  • 5
  • 19
  • By setting the proper permissions. – CodeCaster Jan 07 '15 at 11:47
  • thank you, but where, in which folder – user2622220 Jan 07 '15 at 12:02
  • Could you describe your problem with more details ? I'm not sure that this is permission problem, if so it should be enough that user of your server have access permission to website directory (but I guess he has this access already) I've had similar problem once. How you render view ? using actionAsPdf or something ? – zenichi Jan 07 '15 at 15:25

4 Answers4

3

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
mike123
  • 1,549
  • 15
  • 23
  • I faced similar issue on Win Server 2008 on IIS7.5. What I did is, run the download -> copy wkhtmltopdf.exe and dll to Rotativa folder in IIS app and it started working. Some dlls would always be missing on some servers and it better to use the download than manually adding dlls. – sunder Nov 28 '17 at 11:25
1

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

user2622220
  • 185
  • 1
  • 5
  • 19
1

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
.......................

Balan
  • 421
  • 6
  • 12
0

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.

Tunaki
  • 132,869
  • 46
  • 340
  • 423