javascript - How to set the page height when using window.print? -


i want print page via pos printer, prints long blank page. here js code.

<script>   $("#print").click( function (){       var div_height = document.getelementbyid("yu_jie_dan").clientheight;       var printcontents = document.getelementbyid("yu_jie_dan").innerhtml;       w = window.open("", 'name', 'resizable=1',false);       w.document.write("<body style='width: 230px;font-size: 30px;'>");       w.document.write(printcontents);       w.document.write("</body>");       w.print();       w.close();   }) </script> 

i want set page width 230px , height auto.

there pseudo class in css take effect when trying print html page.

#page-id__or__div-id: print {   // add style here want see in printed documents } 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -