code_junkie

Printing web page programmatically in Java

Nov 11th, 2011
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. <link rel="stylesheet" type="text/css" media="print" href="print.css" />
  2.  
  3. <script>
  4. function printPage() {
  5. window.print();
  6. }
  7. </script>
  8.  
  9. <form>
  10. <input TYPE="button" onClick="printPage()">
  11. </form>
  12.  
  13. <input TYPE="button" onClick="window.print()">
  14.  
  15. <style>
  16. div.tool {
  17. page-break-before: always
  18. }
  19. </style>
  20.  
  21. <div class="tool" id="tool1">
  22. ...
  23. </div>
  24. <div class="tool" id="tool2">
  25. ...
  26. </div>
Add Comment
Please, Sign In to add comment