테스트 사이트 - 개발 중인 베타 버전입니다

웹에서 프린터 출력시 상단하단 없이 출력하기

· 7년 전 · 10532 · 2
005.jpg

문서에서 출력하는 방식으로 출력합니다.

좀 오래된 것 같은데 필요한 부분이 많이 있을것 같네요..

 

출력할 페이지에 아래의 코드를 삽입한다.

<!-- MeadCo ScriptX -->
  <object id=factory style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="(자기경로)/smsx.cab#Version=7.4.0.8 "></object>

 

// 스크립트에 아래코드 추가

function printPage(){
    factory.printing.header = "가로 페이지 인쇄"; //머릿말 설정
    factory.printing.footer = ""; //꼬릿말 설정
    factory.printing.portrait = false; //출력방향 설정: true-세로, false-가로
    factory.printing.leftMargin = 1.0; //왼쪽 여백 설정
    factory.printing.topMargin = 1.0; //위쪽 여백 설정
    factory.printing.rightMargin = 1.0; //오른쪽 여백 설정
    factory.printing.bottomMargin = 1.0; //아래쪽 여백 설정
    // factory.printing.printBackground = true; //배경이미지 출력 설정:라이센스 필요
    factory.printing.Print(false); //출력하기
   }

 

// 인쇄버튼에서 해당 함수 실행

$( "#print" ).click(function(){
         if( navigator.userAgent.indexOf("MSIE") > 0 ){
          printPage();
         } else if( navigator.userAgent.indexOf("Chrome") > 0){
             window.print();
         }
    });

라이센스관련

 

http://scriptx.meadroid.com/license-pricing/free-deployment.aspx

Free Printing

A basic subset of ScriptX client-side printing functionality -- header & footer settings, printed orientation, coarse control of margins and a browser window/frame printing command -- is available at no charge, and is freely distributable.

 

ScriptX 클라이언트 측 인쇄 기능(헤더 및 바닥글 설정, 인쇄 방향, 여백의 거친 제어 및 브라우저 창/프레임 인쇄 명령)의 기본 하위 집합은 무료로 제공되며 무료로 배포됩니다.

 

배경이미지 크기 760 x 1102

 

<html>
<head>
<title>프린터 출력 테스트</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<STYLE media=print>
<!--
.noPrint
{
 DISPLAY: none
}
//-->
</STYLE>
</head>
<body>
<center>

<style>
body {
 background:url('배경이미지') no-repeat center;
}
td {
 font-size:26px;
 font-family:궁서;
}
</style>

<table style="width:690px;">
 <tr>
  <td style="height:60px;">출력하기
 </tr>
</table>
<table style="width:690px; height:400px;">
 <tr>
  <td>&nbsp;</td>
 </tr>
</table>
 <object id=factory style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://업로드주소/smsx.cab#Version=7,6,0,10 "></object>

<script language=javascript>
function init() {
 var p = factory.printing;
 var printername;
 var defName;
 var name;
 try {
  factory.printing.header = "";   //머릿말 설정');
  factory.printing.footer = "";   //꼬릿말 설정');
  factory.printing.portrait = true;  //출력방향 설정: false-가로, true-세로');
  factory.printing.leftMargin = 0;  //왼쪽 여백 설정');
  factory.printing.topMargin = 0;  //위쪽 여백 설정');
  factory.printing.rightMargin = 0;  //오른쪽 여백 설정');
  factory.printing.bottomMargin = 0;  //아래쪽 여백 설정');
  factory.printing.Preview();
 } catch ( e ) {}
}
init();
</script></body>
</html>

 

참고로 배경 이미지가 출력이 안될 경우

2009320995_1534252116.692.jpg

 

배경색 및 이미지 인쇄 앞에 체크가 안되어 있을때 안나옵니다.

 

 

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 2개

7년 전
좋은 자료 정말 감사합니다.
감사합니다.^^

게시글 목록

번호 제목
23966
23963
23953
23949
23938
23935
23933
23928
23919
23918
23917
23910
23902
23901
23897
23894
23893
23891
23885
23872
23870
23862
23859
23853
23845
23838
23827
23819
23805
23801