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.
I had the same issue, and solved it by changing it to something like:
<link href="@Server.MapPath("~/Content/bootstrap.min.css")" rel="stylesheet" />
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"));
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>
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.
© 2022 - 2024 — McMap. All rights reserved.