javascript - how to trigger a print request to clients machine using jquery -
here in, have nested divs..in images generate dynamically ...this html code ..my problem if click print button corresponding image need printed.
<div id="outputtemp" style="display:none"> <div id="rightoutputimgae"> <div id="rightimgid" class="rightimg" rel="tooltip" content=" <img src='jqe13/image/1.jpg' class='tooltip-image'/> "> <div id="outputimageid" class="outputimage"> <img src="jqe13/image/1.jpg" alt="right bottom image"></div> </div> <ul> <li id="outcheckbox"><input name="outcheck" type="checkbox"></li> <li id="outedit"> <a href="#"><img src="jqe13/image/edit_s.png" alt="edit" title="edit"> </a></li> <li id="outdelete"><a href="#" onclick="deleteimg(div11)"> <img src="jqe13/image/delet_c.png" alt="delete" title="delete"></a></li> <li id="outfullscreen"> <a href="#"> <img src="jqe13/image/fullscreen_c.png" alt="full screen" class="fullscreen" title="full screen"></a></li> <li id="outshare"> <a href="#"><img src="jqe13/image/share_c.png" alt="share" title="share"></a> <div id="menu"> <div id="tooltip_menu"> <a href="#" class="menu_top" id="email"> <img src="jqe13/image/email.png" alt="email" title="email"></a> <a href="#" onclick="posttofeed()" class="facebook"><img src="jqe13/image/fb.png" alt="facebook" title="facebook"></a> <a href="#" id="twitter"> <img src="jqe13/image/twitter.png" alt="twitter" title="twitter"></a> <a href="#" class="menu_bottom" id="save"> <img src="jqe13/image/save.png" alt="save" title="save"></a> </div> </div> </li> <li id="outprint"><a href="#"> <img src="jqe13/image/print.png" class="printme" alt="print" title="print"></a> </li> </ul> </div>
i need print image when click print button.. , need print images clicking button need create later..
javascript
$('.printme').click(function() { window.print(); return false; });
does work me..can me this..
you have open new window , load picture there. after trigger window.print in it.
if way going, create simple page simplify it
name printimage.html, , use following markup
<html> <script> function onload() { var url = window.location.search.substring(1) var img = document.getelementbyid('img') img.src = url window.print() } </script> <body onload="onload()"> <img href="" id='img' /> </body> </html>
having you'll able new window image printimage.html?myfullpathtotheeimage.jpg
actually 2nd option offered @kennypu quite simple implement
add following stylesheet page
@media print { * { display:none; } .print { display:block } }
then toggle print
class element going print.
Comments
Post a Comment