기존에 대부분 스킨에서 프린트 기능을 구현하려면,
간단하게는 window.print(); 를 사용해서 전체를 프린트 하게 하거나...
새창으로 띄워서 새창 전체를 프린트하는 기법을 사용하는데...
새창안을 띄우지 않고 필요한 부분만 프린트하는 소스입니다.
일단 게시물 본문만 프린트 하려면 아래와 같이 추가해 주시면 됩니다.
<iframe name=print_content id=print_content width=1 height=1 style="visibility:hidden;"></iframe>
<script>
function content_printer ()
{
print_content.document.open();
print_content.document.writeln("<html><head><style>body,td,p,pre,input,textarea,select,option,a,a:hover {font-size:9pt; font-family:tahoma,굴림;}</style></head><body>"); //스타일등을 지정
print_content.document.writeln('<?=$memo?>'); // 본문 출력
print_content.document.writeln("</body></html>");
print_content.document.close();
print_content.document.execCommand('Print');
}
</script>
<a onclick="content_printer();" style="cursor:hand;">프린트하기</a>
간단하게는 window.print(); 를 사용해서 전체를 프린트 하게 하거나...
새창으로 띄워서 새창 전체를 프린트하는 기법을 사용하는데...
새창안을 띄우지 않고 필요한 부분만 프린트하는 소스입니다.
일단 게시물 본문만 프린트 하려면 아래와 같이 추가해 주시면 됩니다.
<iframe name=print_content id=print_content width=1 height=1 style="visibility:hidden;"></iframe>
<script>
function content_printer ()
{
print_content.document.open();
print_content.document.writeln("<html><head><style>body,td,p,pre,input,textarea,select,option,a,a:hover {font-size:9pt; font-family:tahoma,굴림;}</style></head><body>"); //스타일등을 지정
print_content.document.writeln('<?=$memo?>'); // 본문 출력
print_content.document.writeln("</body></html>");
print_content.document.close();
print_content.document.execCommand('Print');
}
</script>
<a onclick="content_printer();" style="cursor:hand;">프린트하기</a>
댓글 10개
쉽다zzz
12년 전
잘 쓰겠습니다.
senseme
12년 전
네..좋은 자료가 되었으면 좋겠네욧.
12년 전
냠냠;;;;;;;;;
<script>
function printHTML() {
Pwin = window.open("","","width=900,height=800,scrollbars=1");
wdata ="<HTML>";
wdata += document.getElementById("print").innerHTML;
wdata += "";
Pwin.document.write(wdata);
Pwin.window.print();
Pwin.window.location.reload();
}
</script>
<div id="print">
프린트할부분을 div로 감싸준다
</div>
저는 이거 쓰는데..........
<script>
function printHTML() {
Pwin = window.open("","","width=900,height=800,scrollbars=1");
wdata ="<HTML>";
wdata += document.getElementById("print").innerHTML;
wdata += "";
Pwin.document.write(wdata);
Pwin.window.print();
Pwin.window.location.reload();
}
</script>
<div id="print">
프린트할부분을 div로 감싸준다
</div>
저는 이거 쓰는데..........
senseme
12년 전
새로운 팁을 알게되었네요..감사합니다.
DanEtre
12년 전
감사합니다.^^
senseme
12년 전
감사합니다^^
쉽다zzz
12년 전
잘봤어요~
senseme
12년 전
감사합니다^^
12년 전
감사용
takumi22
12년 전
잘봤습니다.
게시판 목록
팁게시판
디자인과 관련된 유용한 정보를 공유하세요.
질문은 상단의 QA에서 해주시기 바랍니다.
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5277 |
jinmuk
|
12년 전 | 6718 | |
| 5276 |
jinmuk
|
12년 전 | 2398 | |
| 5275 |
jinmuk
|
12년 전 | 9274 | |
| 5274 |
jinmuk
|
12년 전 | 1908 | |
| 5273 |
jinmuk
|
12년 전 | 2324 | |
| 5272 |
jinmuk
|
12년 전 | 3181 | |
| 5271 |
jinmuk
|
12년 전 | 2152 | |
| 5270 |
jinmuk
|
12년 전 | 2325 | |
| 5269 |
jinmuk
|
12년 전 | 2294 | |
| 5268 |
jinmuk
|
12년 전 | 1590 | |
| 5267 |
jinmuk
|
12년 전 | 1384 | |
| 5266 |
jinmuk
|
12년 전 | 1034 | |
| 5265 |
jinmuk
|
12년 전 | 1211 | |
| 5264 |
jinmuk
|
12년 전 | 1997 | |
| 5263 |
jinmuk
|
12년 전 | 1546 | |
| 5262 |
jinmuk
|
12년 전 | 1258 | |
| 5261 |
jinmuk
|
12년 전 | 2290 | |
| 5260 |
jinmuk
|
12년 전 | 2038 | |
| 5259 |
jinmuk
|
12년 전 | 1879 | |
| 5258 |
jinmuk
|
12년 전 | 1615 | |
| 5257 |
jinmuk
|
12년 전 | 2308 | |
| 5256 |
jinmuk
|
12년 전 | 1129 | |
| 5255 | 12년 전 | 1025 | ||
| 5254 | 12년 전 | 2434 | ||
| 5253 | 12년 전 | 2425 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기