5

I am using rotativa in MVC3 for downloading multiple views in pdf format. Its working fine in my local system. But when I moved that to production its taking almost 2-3 min to download. Please suggest any option to make that faster in production.

I am using ViewAsPdf in rotativa.

  return new ViewAsPdf("PDF") { FileName = "Application1.pdf", CustomSwitches = "--print-media-type" };

Thanks.

Saritha.S.R
  • 800
  • 1
  • 6
  • 19
  • 1
    One of the problems I've seen before in these scenarios is that the server doesn't have the same network configurations that clients do. I've actually seen many web servers that can't even resolve their own DNS name. Do you have command line access to the server? If so, try running wkhtmltopdf (rotativa wraps that) from the command line and see if there are any messages. Or better, trying running [something like this](http://stackoverflow.com/a/6787041/231316) and looking at stdout so you can see what it does under the same security context. – Chris Haas Jul 01 '14 at 02:28
  • Css pages also not rendering in production server. Can you explain me more? – Saritha.S.R Jul 01 '14 at 04:40
  • 1
    The CSS not rendering is an important detail. If I were to guess, your server is trying get those files and is timing out after 30 or 60 seconds which is why it is taking so long. It could be a DNS resolution problem where your server's internal DNS doesn't match the public. It could also be that the private network can't figure out public DNS requests relative to the private network. Or maybe an SSL cert is getting in the way. Or maybe just relative versus absolute paths in your HTML. Try running wkhtmltopdf manually and examining the logs – Chris Haas Jul 01 '14 at 13:42

1 Answers1

0

it may happen because of the unnecessary linking of js & css files that are linked in the layout page of your view page. Try to make a separate layout page for pdf pages and keep only the related js & css calls which are only needed for pdf generation(design related). I faced the same issue & this approach solved my issue in production.