Click here to Skip to main content
15,909,530 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having a popup window where the data has been dynamically created and push into that popup window.Inside the Popup window i am having an option to print that details.So while selecting that option using jQuery the "popup.print();" is called and the print preview page is displayed.Here i want to insert "Page Break " after each 15 rows.How can i do that?Please help.

Eg:
Suppose the dynamic data that pushed to Popup Page is
HTML
<div>
  <table>
    <tr><td>1<td></tr>
    <tr><td>2<td></tr>
      ........
      ........
    <tr><td>40<td></tr>
  </table>
</div>


This data is passed to a jQuery function "PrintStringData(data);" on "Print" button click and defined like
JavaScript
function PrintStringData(Data) {
      
    var Printdatas = Data;
    var tmp = document.createElement("DIV");
    tmp.innerHTML = Printdatas;

    Printdatas = tmp.textContent || tmp.innerText || tmp.innerHTML || tmp.outerHTML || "";
   
    popup = window.open(null, '', 'toolbar=0,titlebar=0,fullscreen=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 82,top = 54', '');
    popup.document.write(Printdatas);
    popup.print();
}
Posted
Updated 14-Oct-15 20:47pm
v2
Comments
Ajith K Gatty 15-Oct-15 2:26am    
Please add your code snippets so that it will be easy to help you :)
Krunal Rohit 15-Oct-15 4:33am    
Try to add a new page after 15 rows.
Use page-break-after.

http://www.w3schools.com/cssref/pr_print_pageba.asp

-KR
fiashieen 15-Oct-15 6:42am    
Tried that one too.But not working.:(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900