|
Rank: Newbie Groups: Member
Joined: 8/9/2013 Posts: 6
|
I am using bootstrap.css and using its grid css to style the layout. However, when I convert to pdf the grid styles are lost. Anything I should be doing differently? Below is my code: _layout.cshtml
Code: HTML/ASPX
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title</title>
<link href="~/Content/bootstrap.min.css?rev=1" rel="stylesheet" type="text/css" />
<link href="~/Content/bootstrap-theme.min.css" rel="stylesheet" />
<script src="~/Scripts/modernizr-2.6.2.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<span class="navbar-brand"></span>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
</div>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
</body>
</html>
Controller.cs
Code: C#
[HttpPost]
[RenderAsPDF(AutoConvert = false)]
public ActionResult TimeSheet(TimeSheetViewModel model)
{
// convert to pdf
MVCToPDF.SendToClient = false;
HtmlToPdf.Options.OutputArea = new RectangleF(0.5f, 0.5f, 7.5f, 10f);
MVCToPDF.RenderAsPDF();
return View("TimeSheet", model);
}
protected override void OnResultExecuted(ResultExecutedContext filterContext)
{
base.OnResultExecuted(filterContext);
HtmlToPdfResult result = MVCToPDF.Result;
if (result != null)
{
string pdfFileName = "c:\\test.pdf";
result.PdfDocument.Save(pdfFileName);
}
}
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,275
|
Hi,
What version of EO.Pdf are you using?
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 8/9/2013 Posts: 6
|
EO.2016 MVC4
|
|
Rank: Newbie Groups: Member
Joined: 8/9/2013 Posts: 6
|
The issue I'm having has nothing to do with EO. The issue is related to the css classes I applied for the bootstrap grid layout. I changed it from col-md-1 to col-sm-1 and this solved the layout issue in the pdf.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,275
|
Great. Glad to hear that you found out the root of the problem.
Thanks!
|
|