Oracle APEX - Create a Printable Page

Oracle APEX - Create a Printable Page

// dynamic action on button click
var divElements = document.getElementById("EXE_TASKS").innerHTML;
var oldPage = document.body.innerHTML;
// create a new page on the fly and only display the items you want to print
// in this example "EXE_TASKS" is the static ID of an IR
document.body.innerHTML = "<html><head><title></title></head><body>" 
+ divElements + "</body>";

$("#EXE_TASKS_toolbar").hide();
$(".a-IRR-controlsContainer").hide();
$(".t-StatusList-legend").hide();
//
window.print();
// un-hide the items previously hidden before printing
$("#EXE_TASKS_toolbar").show();
$(".a-IRR-controlsContainer").show();
$(".t-StatusList-legend").show();
document.body.innerHTML = oldPage;
// a page refresh should follow this (location.reload();)