2014-07-24 2 views
-1

jQuery를 사용하여 프린터에 문자열을 인쇄하는 방법은 무엇입니까?jQuery를 사용하여 프린터에 문자열을 인쇄하는 방법

페이지에 인쇄 아이콘 버튼이 있고 프린터에 문자열을 인쇄하고 싶습니다. 어떻게해야합니까?

+2

만 사용하는 인쇄()와 표시됩니다 프린터 대화 상자를 ... JQuery와 – rafaelcastrocouto

+0

의 필요가 없습니다 http://plugins.jquery.com/tag/ 인쇄/ – bhushya

답변

0

내가 printThis.js 사용하여 종료 - https://github.com/jasonday/printThis

// uses jQuery "printThis.js" plugin file and "PrintThis.css" style sheet 
function printNotification(printButtonElement, notificationBar) { 

    // make copy of div, remove icon, add line breaks after date and then print 
    var x = $(printButtonElement).parent().parent().clone(); 
    x.find("i").remove(); 
    x.find(".ReportedDate").after("<br\><br\>"); 
    x.printThis({ loadCSS:"../Content/PrintThis.css"}); // css hides buttons and right aligns the date 

    return true; 
} 
관련 문제