<html>
		
			<head>
		
			    <title></title>
		
			</head>
		
			<body>
		
			    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
		
			    <script type="text/javascript">
		
			        var app = angular.module('MyApp', [])
		
			        app.controller('MyController', function ($scope, $window) {
		
			            $scope.PrintDIV = function () {
		
			                var contents = document.getElementById("dvContents").innerHTML;
		
			                var body = document.getElementsByTagName("BODY")[0];
		
			 
		
			                //Create a dynamic IFRAME.
		
			                var frame1 = document.createElement("IFRAME");
		
			                frame1.name = "frame1";
		
			                frame1.setAttribute("style", "position:absolute;top:-1000000px");
		
			                body.appendChild(frame1);
		
			 
		
			                //Create a Frame Document.
		
			                var frameDoc = frame1.contentWindow ? frame1.contentWindow : frame1.contentDocument.document ? frame1.contentDocument.document : frame1.contentDocument;
		
			                frameDoc.document.open();
		
			 
		
			                //Create a new HTML document.
		
			                frameDoc.document.write('<html><head><title>DIV Contents</title>');
		
			                frameDoc.document.write('</head><body>');
		
			 
		
			                //Append the external CSS file.
		
			                frameDoc.document.write('<link href="style.css" rel="stylesheet" type="text/css" />');
		
			 
		
			                //Append the DIV contents.
		
			                frameDoc.document.write(contents);
		
			                frameDoc.document.write('</body></html>');
		
			                frameDoc.document.close();
		
			 
		
			                $window.setTimeout(function () {
		
			                    $window.frames["frame1"].focus();
		
			                    $window.frames["frame1"].print();
		
			                    body.removeChild(frame1);
		
			                }, 500);
		
			            };
		
			        });
		
			    </script>
		
			    <div ng-app="MyApp" ng-controller="MyController">
		
			        <link href="style.css" rel="stylesheet" type="text/css" />
		
			        <div id="dvContents">
		
			            <div class="left">
		
			                <img alt="" src="images/ASPSnippets.png" />
		
			            </div>
		
			            <div class="right">
		
			                <span class="label">ASPSnippets.com Sample page</span>
		
			            </div>
		
			            <div class="clear">
		
			            </div>
		
			            <hr />
		
			            <div class="contents">
		
			                <span class="label">Hello,
		
			                    <br />
		
			                    This is <span class="name">Mudassar Khan</span>.<br />
		
			                    Hoping that you are enjoying my articles! </span>
		
			            </div>
		
			        </div>
		
			        <br />
		
			        <input type="button" value="Print" ng-click="PrintDIV()" />
		
			    </div>
		
			</body>
		
			</html>