<!doctype html>
<meta charset="utf-8">
<script>
function handlePrint() {
  frames[0].frameElement.style.display = "none";
  frames[1].print();
}
</script>
<iframe srcdoc='<button onclick="parent.handlePrint()">Print the other iframe, then hide me</button>'></iframe>
<iframe id="iframe2" srcdoc="Print me"></iframe>
