Consider the following code example:
<!DOCTYPE html>
<html>
<head>
<title>HTML5-Template</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
.print_this{
display: none;
}
@media print {
.print_this {
display: block;
width: 1024px;
height: 768px;
}
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function () {
setTimeout(function () {
var el = document.getElementById("report");
el.focus();
el.print();
}, 1500);
});
</script>
</head>
<body>
<div id="Container">
<object class="print_this" id="report" name="report" type="application/pdf" data="Certificate.pdf"></object>
</div>
</body>
</html>
I want to hide the object from the user in the window, but print ONLY the contents of the tag when the print dialog is displayed...is this possible?
NOTE: Code was from elsewhere on the internet, however I have a feeling this is very much, non standards based?