I have a problem when using rotativa, that my bootstrap page always scales to minimum when printed. Is there any way I can set viewport size for my view, so it wont scale bootstrap to minimum for PDF generation?
Controller implementation
[HttpGet]
public ActionResult DownloadViewPDF()
{
var vm = new Viewmodel();
return new Rotativa.ViewAsPdf("SummaryPDF", vm) { FileName = "TestViewAsPdf.pdf", PageSize = Size.A4 };
}
And this is my general view implementation
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span class="label">Email</span>
<span class="form-control-static">test@email.com</span>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<div class="required-enabled">
<span class="label">Phone</span>
<span class="form-control-static">(804) 222-1111</span>
</div>
</div>
</div>
</div>
I've tried a few things, for an example using the PageSize, PageHeight, PageWidth settings of rotativa. Nothings seems to prevent the scaling. I've also tried using CustomSwitches, but couldnt really find a setting that provided the result I wanted.
I've also tried setting a static viewport size in the html meta tag, and encapsulating my view in a div with static width. None of these things seem to prevent my PDF from being scaled to minimum possible bootstrap display.
The solution ended up being putting all our responsive design into tables, thus trashing the responsive design for the print part. There seemed to be no other way that I could find. It would be nice with a feature to just specify viewport size for the print.