How to save div as PDF without any client side tooling in asp.net?
The code below does not work in Internet Explorer requesting additional client side tools.
function printDiv(divID) {
//Get the HTML of div
var divElements = document.getElementById(divID).innerHTML;
//Get the HTML of whole page
var oldPage = document.body.innerHTML;
//Reset the page HTML with div HTML only
document.body.innerHTML = "<html><head></head><body>" + divElements + "</body>";
//Print Page
window.print();
//Restore orignal HTML
document.body.innerHTML = oldPage;
//disable postback on print button
return false;
}
+3
source to share