1)) 나는 "인라인"colorbox 옵션으로 전환 제안 (하지만 당신은 필요가 없습니다 :
<script type="text/javascript">
$(document).ready(function(){
$(".pricing").colorbox({width:"733px", height:"699px", iframe:false, open:true, overlayClose:true, opacity:.5, initialWidth:"300px", initialHeight:"100px", transition:"elastic", speed:350, close:"Close", photo:false, inline:true, href:"#price_report"});
});
</script>
2) 이제 인쇄 가능 영역을 작성하는 자바 스크립트 코드를 포함하여 HTML을 추가 :
<div style='display: none'>
<div id='price_report' class='pricing'>
<script type="text/javascript">
//<!--
function ClickHereToPrint(){
try{
var oIframe = document.getElementById('ifrmPrint');
var oContent = document.getElementById('pricingPrintArea').innerHTML;
var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
if (oDoc.document) oDoc = oDoc.document;
oDoc.write("<html><head><title>My Printable Pricing Report!</title>");
oDoc.write("<link rel='stylesheet' href='link-to-my-styles/style.css' type='text/css' />");
oDoc.write("</head></body><body onload='this.focus(); this.print();' style='text-align: left; font-size: 8pt; width: 432pt;'>");
oDoc.write("<h3>My Pricing Report</h3>");
oDoc.write(oContent + "</body></html>");
oDoc.close();
}
catch(e){
self.print();
}
}
//-->
</script>
<iframe id='ifrmPrint' src='#' style="width:0pt; height:0pt; border: none;"></iframe>
<div id="pricingPrintArea">
<div class="myreport">
<p>Hello, I am a pricing report!</p>
</div>
</div>
</div>
</div>
3) 이제 당신이 원하는 어디든지 인쇄 버튼을 추가
<div id="print_btn">
<a href="#" onclick="ClickHereToPrint();" style="cursor: pointer;">
<span class="print_btn">
Click Here To Print This Report!
</span>
</a>
</div>
주, 빈 IFRA 나를 포함 자바 스크립트가 귀하의 인쇄 영역을 작성합니다 것입니다. 또한 자바 스크립트에서 스타일 시트, 인라인 스타일, 페이지 제목 등을 추가 할 수 있습니다.
이 프로세스는 colorbox의 ajax 버전과 유사하지만, ajax 메소드의 경로를 따라 가면 인쇄 가능한 div를 작성하고 iframe을 인쇄하고 javascript를 외부로 직접 인쇄해야합니다 파일.
이론적으로 인쇄 할 수있는 영역 div (이 예 : pricingPrintArea)의 내용이 인쇄되므로 인쇄 할 내용을 줄 바꿈 할 때마다 인쇄 할 수 있습니다.
중요 팁 : 프린터는 모두 웹 페이지를 다르게 읽으므로 인라인 스타일과 픽셀 크기를 인쇄 가능한 버전에 너무 많이 사용하지 마십시오. 이것이 인쇄 가능한 페이지를 위해 특별히 스타일 시트를 만드는 것이 좋은 이유입니다.
잘하면 답변을 귀하의 질문. (btw, 당신은이 방법을 colorbox의 ajax 메소드와 함께 사용할 수 있어야하지만, 테스트하지는 않았다).