Now normally I would not do this all inline. But for the purpose of this question I felt it was easier to read this way. Basically setup a media style sheet that allows a printable area. then assign your html to that div. Now when print is hit only the #printableArea will be sent to the printer.
<html>
<head>
<style type="text/css">
#printableArea { display: none; }
@media print
{
#non-printableArea { display: none; }
#printableArea { display: block; }
}
</style>
<script type="text/javascript">
$(document).ready(function () {
var h = "<html><head></head><body><h1>Example</h1><p>This is a variable I want to print to the printer with the browser!</p></body></html>";
$("#printableArea").html(h.find("body").html());
});
</script>
</head>
<body>
<div id="printableArea"></div>
<div id="non-printableArea"></div>
</body>
</html>