Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

html table to pdf jquery

<body>

	<div id="printThis">
		<div class="container">
			<br><br>
			<center>lorem</center>
			<center>
				<table>
					<tr>
						<th>Id</th>
						<th>Name</th>
						<th>someth</th>
						<th>woring</th>
					</tr>
					<tr>
						<td>1</td>
						<td>jerry</td>
						<td>Account</td>
						<td>berlin</td>
					</tr>
					<tr>
						<td>1</td>
						<td>jerry</td>
						<td>Account</td>
						<td>berlin</td>
					</tr>
				</table>
			</center>
		</div>
	</div>

<center>
	<input type="submit" value="Print" id="PrintBtn"  name="">
</center>
    <script>
    
     $('#printBtn').click(function () {
            var openWindow = window.open("", "", "_blank");
            openWindow.document.write($('#printThis').parent().html());
            openWindow.document.write('<style>' + $('style').html() + '</style>');
            openWindow.document.close();
            openWindow.focus();
            openWindow.print();
            // openWindow.close();
            setTimeout(function () {
                openWindow.close();
            }, 1000)

        })
    </script>

</body>
 
PREVIOUS NEXT
Tagged: #html #table #pdf #jquery
ADD COMMENT
Topic
Name
3+4 =