Rotativa correctly shows and renders a PDF with my Bootstrap when hosted locally, but not once it is posted to the server. The rendered PDF shows some CSS, but no Bootstrap. I have seen other posts about this, but the suggestions did not work. The Rotativa folder is in the root of the web app as suggested.
-
make sure your files path on the server matches the ones locally. or at least adjust your code. – Coding Enthusiast Jun 05 '15 at 13:56
4 Answers
I had the same issue, and solved it by changing it to something like:
<link href="@Server.MapPath("~/Content/bootstrap.min.css")" rel="stylesheet" />

- 2,748
- 21
- 18
-
2I eventually did just have to include the style sheet explicitly on that page, not the layout page. It worked. – Rachel Ostrander Jul 21 '15 at 15:12
-
If you are using bundles, .min
files are ignored by default so my best guess will be to use this:
bundles.IgnoreList.Clear();
I don't know if you have already created the bundles:
<!--Create route for the bundles like this:-->
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.min.css",
"~/Content/main.css"));

- 3,865
- 1
- 27
- 50
-
I have both the bundle you suggested and the IgnoreList.Clear(); I have just tried creating a user in Active Directory and passing the credentials as Custom Switches, but so far that does not work either. According to research I just did, adding Active Directory authentication breaks Rotativa. Any suggestions on how to circumvent that would be helpful and thanks for the above ideas. – Rachel Ostrander Jun 05 '15 at 15:15
This situation can occur when your site uses windows authentication.
You need to give access to your CSS files in the web.config as follows:
<location path="content">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>

- 5,098
- 1
- 50
- 73
One of these 3 things fixed this issue for us. we used https://www.w3schools.com/w3css/w3css_validation.asp to validate our css, and found some minor problems, which we corrected.
We used Ozz's fix.
As before, it worked normally for us in IIS Express on our desktops.
Then we published the app to the webserver and noticed that it was now working.
So it was either
- Ozz's fix
- Rotativa freaked out at our malformed css (but why only on the webserver?)
- just recopying the app up from our local desktops to the web server "unclogged" something.
We're still testing, but first pass it looks like this worked.

- 46
- 3