window-print-subframe.html 573 B

123456789101112131415
  1. <p style="height: 2000px">
  2. This text in the main frame should not be printed
  3. when the sub frame (scroll down to see it) initiates printing.
  4. </p>
  5. <iframe srcdoc="
  6. <p>This <a href='#target'>link</a> in the subframe should be printed.</p>
  7. <button onclick='print()'>Print</button>
  8. <p>In the saved pdf, clicking the above link should navigate to the page containing 'TARGET'</p>
  9. <div style='height: 2000px'></div>
  10. <a name='target'>TARGET</a>
  11. <div style='height: 2000px'></div>
  12. <script>
  13. setTimeout(function() { window.print(); }, 500);
  14. </script>">
  15. </iframe>