답변

1

나는 this 질문에서 this 답변이 도움이 될 것입니다 생각 : 귀하의 경우

HTMLElement.prototype.printMe = printMe; 
function printMe(query){ 
    var myframe = document.createElement('IFRAME'); 
    myframe.domain = document.domain; 
    myframe.style.position = "absolute"; 
    myframe.style.top = "-10000px"; 
    document.body.appendChild(myframe); 
    myframe.contentDocument.write(this.innerHTML) ; 
    setTimeout(function(){ 
    myframe.focus(); 
    myframe.contentWindow.print(); 
    myframe.parentNode.removeChild(myframe) ;// remove frame 
    },3000); // wait for images to load inside iframe 
    window.focus(); 
} 

사용법 : 모든

document.getElementsByClassName("receiptSectionTable2Col")[0].printMe(); 
+0

먼저 답장을 보내 주셔서 감사합니다. 나는이 예제를 위해 할 수 없었습니다 ... https://developer.chrome.com/extensions/examples/api/bookmarks/basic.zip – alon3wolf

+0

정확히 무엇이 필요한지 전혀 모르겠지만 아마 당신이 맞을 것입니다. 그것을 달성하기 위해 [콘텐츠 스크립트] (https://developer.chrome.com/extensions/content_scripts)가 필요합니다. 당신이 내가 당신을 도우려는 경우 당신이 가지고있는 문제에 대해 더 구체적으로 질문을 편집해야합니다. – PredatorIWD

+0

58mm 칩 프린터에서 위 주소에 지정된 페이지를 인쇄하고 싶습니다. 해당 페이지의 지정된 위치 (지정된 div 내용) 만 인쇄하려고합니다. 크롬 확장 인쇄 샘플을 통해이 작업을하고 싶었지만 할 수 없었습니다. 인쇄 아이콘을 누르면 http://sezgin.net.tr/fatura.html 페이지에 특정 영역을 인쇄하고 싶습니다. – alon3wolf

관련 문제