Print() : 프린트 버튼 클릭시 pdf 파일 인쇄하기 창 띄우기
'프린트' 버튼 클릭시 pdf 파일 인쇄하기 창 띄우기
function printTrigger(elementId) {
var getMyFrame = document.getElementById(elementId);
getMyFrame.focus();
getMyFrame.contentWindow.print();
};
/* 영어 매뉴얼 인쇄 */
jQuery("#Manuel_Print_EN").click(function(){
printTrigger('iFramePdf_EN');
});
1. 버튼에 아이디 입력 : #Manuel_Print_EN
2. 컬럼에 다음 코드 입력 : <iframe id="iFramePdf_EN" src="xxx.pdf" style="width:1px; height:1px; opacity:0;"></iframe>
===========================================================================
Re: How to print Pdf file through window.Print() ?
Sep 30, 2013 06:47 PM|LINK
A function to house the print trigger:
function printTrigger(elementId) {
var getMyFrame = document.getElementById(elementId);
getMyFrame.focus();
getMyFrame.contentWindow.print();
}
An button to give the user access: (an onClick on an a or button or input or whatever you wish)
<input type="button" value="Print" onclick="printTrigger('iFramePdf');" />
An iframe pointing to your PDF:
<iframe id="iFramePdf" src="myPdfUrl.pdf" style="dispaly:none;"></iframe>
Source: http://stackoverflow.com/questions/687675/can-a-pdf-files-print-dialog-be-opened-with-javascript
※ 익스플로러, 파이어폭스에는 정상 작동 안함
출처 : ASP.NET forum : How to print Pdf file through window.Print() ?
원출처 : https://stackoverflow.com/questions/687675/can-a-pdf-files-print-dialog-be-opened-with-javascript