js-print is a print plugin that based on pure Javascript.
<html>
<head>
...
</head>
<body>
...
<div id="test-print-area">
...
</div>
...
</body>
<script async type="text/javascript" src="js-print.js"></script>
</html>
var element = document.getElementById('test-print-area');
if (element) {
element.print(); // unstyled
element.print({ importCss: true }); // styled
}
<html>
<head>
...
</head>
<body>
...
<div id="test-print-area">
...
</div>
...
</body>
<script async type="text/javascript" src="js-print-function.js"></script>
</html>
print({
elementName: '.test-print-area',
importCss: true
});