问题
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
回答1:
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
回答2:
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
回答3:
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
.......................
回答4:
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.
来源:https://stackoverflow.com/questions/27818766/rotativa-pdf-does-not-work-on-server