I have the following code to print a table that is held by my application:
var elementToPrint = this.mainTable.get(0);
newWin = window.open("");
newWin.document.write('<html><head><title>' + elementToPrint.caption + '</title>' +
'</head><body class=\'visible-print\'>');
newWin.document.write(elementToPrint.outerHTML);
newWin.print();
newWin.close();
Where this.mainTable is a jQuery object.
At my common page (_Layout.cshtml) I have:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="UTF-8" />
<title>MyApp</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" media="all">
<link href="@Url.Content("~/Content/bootstrap-theme.min.css")" rel="stylesheet" media="all">
</head>
The print routine runs fine, except that it looses all styling, printing plain text with unformatted data (side by side data).
I need to keep the original bootstrap layout (colors, borders, strips, etc.). What please needs to be changed...
Thanks,