웹에서 프린터 출력시 상단하단 없이 출력하기 > 그누보드5 팁자료실

그누보드5 팁자료실

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

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

첨부파일

smsx.cab (1.5M) 155회 다운로드 2018-08-14 22:14:54
005.jpg (69.3K) 11회 다운로드 2018-08-14 22:08:57

본문

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

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

 

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

<!-- 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> </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

 

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

 

 

추천
8

댓글 2개

전체 2,427 |RSS
그누보드5 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT