인쇄시 행간이 벌어진 문제
본문
그림와 본것 같이 그냥 view로 볼때에는 행간이 정상인데 게시판 인쇄하는 기능이 있어서 인쇄하면 행간이 한칸씩 뛰엄뛰엄 되네요
view.php
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);
?>
<script src="<?php echo G5_JS_URL; ?>/viewimageresize.js"></script>
<!-- 게시물 읽기 시작 { -->
<article id="bo_v" style="width:<?php echo $width; ?>">
<header>
<h2 id="bo_v_title">
<?php if ($category_name) { ?>
<span class="bo_v_cate"><?php echo $view['ca_name']; // 분류 출력 끝 ?></span>
<?php } ?>
<span class="bo_v_tit">
<?php
echo cut_str(get_text($view['wr_subject']), 70); // 글제목 출력
?></span>
</h2>
</header>
<section id="bo_v_info">
<h2>페이지 정보</h2>
<div class="profile_info">
<div class="pf_img"><?php echo get_member_profile_img($view['mb_id']) ?></div>
<div class="profile_info_ct">
<span class="sound_only">작성자</span> <strong><?php echo $view['name'] ?><?php if ($is_ip_view) { echo " ($ip)"; } ?></strong><br>
<span class="sound_only">댓글</span><strong><a href="#bo_vc"> <i class="fa fa-commenting-o" aria-hidden="true"></i> <?php echo number_format($view['wr_comment']) ?>건</a></strong>
<span class="sound_only">조회</span><strong><i class="fa fa-eye" aria-hidden="true"></i> <?php echo number_format($view['wr_hit']) ?>회</strong>
<strong class="if_date"><span class="sound_only">작성일</span><i class="fa fa-clock-o" aria-hidden="true"></i> <?php echo date("y-m-d H:i", strtotime($view['wr_datetime'])) ?></strong>
</div>
</div>
<!-- 게시물 상단 버튼 시작 { -->
<div id="bo_v_top">
<?php ob_start(); ?>
<ul class="btn_bo_user bo_v_com">
<li><a href="<?php echo $list_href ?>" class="btn_b01 btn" title="목록"><i class="fa fa-list" aria-hidden="true"></i><span class="sound_only">목록</span></a></li>
<?php if ($reply_href) { ?><li><a href="<?php echo $reply_href ?>" class="btn_b01 btn" title="답변"><i class="fa fa-reply" aria-hidden="true"></i><span class="sound_only">답변</span></a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b01 btn" title="글쓰기"><i class="fa fa-pencil" aria-hidden="true"></i><span class="sound_only">글쓰기</span></a></li><?php } ?>
<?php if($update_href || $delete_href || $copy_href || $move_href || $search_href) { ?>
<li>
<button type="button" class="btn_more_opt is_view_btn btn_b01 btn"><i class="fa fa-ellipsis-v" aria-hidden="true"></i><span class="sound_only">게시판 리스트 옵션</span></button>
<ul class="more_opt is_view_btn">
<?php if ($update_href) { ?><li><a href="<?php echo $update_href ?>">수정<i class="fa fa-pencil-square-o" aria-hidden="true"></i></a></li><?php } ?>
<?php if ($delete_href) { ?><li><a href="<?php echo $delete_href ?>" onclick="del(this.href); return false;">삭제<i class="fa fa-trash-o" aria-hidden="true"></i></a></li><?php } ?>
<?php if ($copy_href) { ?><li><a href="<?php echo $copy_href ?>" onclick="board_move(this.href); return false;">복사<i class="fa fa-files-o" aria-hidden="true"></i></a></li><?php } ?>
<?php if ($move_href) { ?><li><a href="<?php echo $move_href ?>" onclick="board_move(this.href); return false;">이동<i class="fa fa-arrows" aria-hidden="true"></i></a></li><?php } ?>
<?php if ($search_href) { ?><li><a href="<?php echo $search_href ?>">검색<i class="fa fa-search" aria-hidden="true"></i></a></li><?php } ?>
</ul>
</li>
<?php } ?>
</ul>
<script>
jQuery(function($){
// 게시판 보기 버튼 옵션
$(".btn_more_opt.is_view_btn").on("click", function(e) {
e.stopPropagation();
$(".more_opt.is_view_btn").toggle();
})
;
$(document).on("click", function (e) {
if(!$(e.target).closest('.is_view_btn').length) {
$(".more_opt.is_view_btn").hide();
}
});
});
</script>
<?php
$link_buttons = ob_get_contents();
ob_end_flush();
?>
</div>
<!-- } 게시물 상단 버튼 끝 -->
</section>
<section id="bo_v_atc">
<h2 id="bo_v_atc_title">본문</h2>
<div id="bo_v_share">
<?php include_once(G5_SNS_PATH."/view.sns.skin.php"); ?>
<?php if ($scrap_href) { ?><a href="<?php echo $scrap_href; ?>" target="_blank" class="btn btn_b03" onclick="win_scrap(this.href); return false;"><i class="fa fa-bookmark" aria-hidden="true"></i> 스크랩</a><?php } ?>
</div>
<style>
@page {
size: A4;
margin: 0;
}
@media print {
.page {
margin: 0;
border: initial;
border-radius: initial;
width: initial;
min-height: initial;
box-shadow: initial;
background: initial;
page-break-after: always;
}
}
</style>
<!-- 새창으로 인쇄 -->
<script type="text/javascript">
var win=null;
function printIt(printThis) {
win = window.open('','offprint','width=900 height=1000');
self.focus();
win.document.open();
win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>');
win.document.write('body, td { font-family: Verdana; font-size: 10pt;}');
win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>');
win.document.write(printThis);
win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>');
win.document.close();
setTimeout(function(){
win.print();
win.close();
}, 800);
}
</script>
<div style="float:right">
<a href="javascript:printIt(document.getElementById('printme').innerHTML)"><span class="btn_print" title='프린트'><i class='fa fa-print fa-2x'></i></span></a><p>
</div>
<!-- 본문 내용 시작 { -->
<section id="bo_v_atc">
<h2 id="bo_v_atc_title">본문</h2>
<!-- 본문 내용 시작 { -->
<div id="bo_v_con">
<div id="printme">
<?php
// 파일 출력
$v_img_count = count($view['file']);
if($v_img_count) {
echo "<div id=\"bo_v_img\">\n";
for ($i=0; $i<=count($view['file']); $i++) {
echo get_file_thumbnail($view['file'][$i]);
}
echo "</div>\n";
}
?>
<!-- 개인별 상담 기록지 폼-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="47" align="center" valign="top"><span style="font-weight: bold; font-size: 24px;">개인별 상담 기록지</span></td>
</tr>
<tr>
<td height="81" valign="top"><table width="100%" border="1" cellpadding="0" cellspacing="0" style="font-weight: bold; font-size: 13px;">
<tr>
<td width="14%" height="34" align="center">관리번호</td>
<!--wr_1번-->
<td width="29%"><?php echo $view['wr_1']?></td>
<td width="11%" align="center">상 담 일</td>
<!--wr_2번-->
<td width="28%"><?php echo $view['wr_2']?></td>
<td width="8%" align="center">회차</td>
<!--wr_3번-->
<td width="10%"><?php echo $view['wr_3']?></td>
</tr>
<tr>
<td height="31" align="center">참 여 자</td>
<!--wr_4번-->
<td height="31"><table width="213" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="103" height="26"><?php echo $view['wr_4']?></td>
<!--wr_5번 라디오 버튼-->
<td width="110">
<input type ="radio" name="wr_5" value="남자" <?php echo get_checked($view['wr_5'], '남자'); ?> required="required"/>
남자
<input type ="radio" name="wr_5" value="여자" <?php echo get_checked($view['wr_5'], '여자'); ?>required/>
여자</td>
</tr>
</table></td>
<td height="31" align="center">상담시간</td>
<!--wr_6번-->
<td height="31" colspan="3"><?php echo $view['wr_6']?></td>
</tr>
<tr>
<td height="35" align="center">연락처</td>
<!--wr_7번-->
<td height="35"><?php echo $view['wr_7']?></td>
<td height="35" align="center">상담장소</td>
<!--wr_8번-->
<td height="35" colspan="3"><?php echo $view['wr_8']?></td>
</tr>
<tr>
<td height="35" align="center">장애유형/<br />
정도</td>
<!--wr_9번-->
<td height="35"><?php echo $view['wr_9']?></td>
<td height="35" align="center">보장구/<br />
고려사항</td>
<!--wr_10번-->
<td height="35" colspan="3"><?php echo $view['wr_10']?></td>
</tr>
<tr>
<td height="34" align="center">상담방법</td>
<!--wr_11번-->
<td height="34" colspan="5"><input type ="radio" name="wr_11" value="본인방문(내방)" <?php echo get_checked($view['wr_11'], '본인방문(내방)'); ?> required="required"/>
본인방문(내방)
<input type ="radio" name="wr_11" value="담당자방문" <?php echo get_checked($view['wr_11'], '담당자방문'); ?>required/>
담당자방문
<input type ="radio" name="wr_11" value="기타" <?php echo get_checked($view['wr_11'], '기타'); ?>required/>
기타
<!--wr_12번-->
(<?php echo $view['wr_12']?>)</td>
</tr>
<tr>
<td height="37" align="center">상담유형</td>
<td height="37" colspan="5">
<!--wr_13번-->
<input type ="radio" name="wr_13" value="심리/정서" <?php echo get_checked($view['wr_13'], '심리/정서'); ?> required="required"/>
심리/정서
<input type ="radio" name="wr_13" value="일상생활" <?php echo get_checked($view['wr_13'], '일상생활'); ?>required/>
일상생활
<input type ="radio" name="wr_13" value="주거환경" <?php echo get_checked($view['wr_13'], '주거환경'); ?>required/>
주거환경
<input type ="radio" name="wr_13" value="경제/취업" <?php echo get_checked($view['wr_13'], '경제/취업'); ?>required/>
경제/취업</td>
</tr>
<tr>
<td height="38" align="center">상담목적</td>
<td height="38" colspan="5"><span class="bo_v_tit">
<?php
echo cut_str(get_text($view['wr_subject']), 70); // 글제목 출력
?>
</span></td>
</tr>
<tr>
<td height="46" align="center"><p>상담내용<br />
/<br />
생활패턴</p></td>
<td height="46" colspan="5" valign="top"><p>※ 6하 원칙으로 해서 기록해주세요. (누가, 언제, 어디서, 무엇을, 어떻게, 왜)<br />
<br />
<?php echo get_view_thumbnail($view['content']); ?>
<?php //echo $view['rich_content']; // view_image($view, '0', '') 과 같은 코드를 사용할 경우 ?>
<br />
</p></td>
</tr>
<tr>
<td height="37" align="center">상담가<br />
의견</td>
<!--wr_14번-->
<td height="37" colspan="5"><?php echo $view['wr_14']?></td>
</tr>
<tr>
<td height="44" align="center">지원내용</td>
<td height="44" colspan="5">
<!--wr_15번-->
<input type ="radio" name="wr_15" value="취업연계지원" <?php echo get_checked($view['wr_15'], '취업연계지원'); ?> required="required"/>
취업연계지원
<input type ="radio" name="wr_15" value="취업교육지원" <?php echo get_checked($view['wr_15'], '취업교육지원'); ?>required/>
취업교육지원
<input type ="radio" name="wr_15" value="취업정보제공" <?php echo get_checked($view['wr_15'], '취업정보제공'); ?>required/>
취업정보제공
<input type ="radio" name="wr_15" value="기타" <?php echo get_checked($view['wr_15'], '기타'); ?>required/>
<!--wr_16번-->
기타(<?php echo $view['wr_16']?>)</td>
</tr>
<tr>
<td height="42" align="center">취업내용</td>
<td height="42" colspan="5">
<!--wr_17번-->
<input type ="radio" name="wr_17" value="진행중" <?php echo get_checked($view['wr_17'], '진행중'); ?> required="required"/>
진행중
<input type ="radio" name="wr_17" value="취업포기" <?php echo get_checked($view['wr_17'], '취업포기'); ?>required/>
취업포기
<input type ="radio" name="wr_17" value="완료(취업)" <?php echo get_checked($view['wr_17'], '완료(취업)'); ?>required/>
완료(취업)
<input type ="radio" name="wr_17" value="완료(교육)" <?php echo get_checked($view['wr_17'], '완료(교육)'); ?>required/>
완료(교육)
<input type ="radio" name="wr_17" value="사후관리" <?php echo get_checked($view['wr_17'], '사후관리'); ?>required/>
사후관리
<input type ="radio" name="wr_17" value="기타" <?php echo get_checked($view['wr_17'], '기타'); ?>required/>
기타
<!--wr_18번-->
(<?php echo $view['wr_18']?>)</td>
</tr>
<tr>
<td height="35" align="center">동료지원가</td>
<td height="35" align="center"><?php echo $view['name'] ?> (인)</td>
<td height="35" align="center">슈퍼<br />
바이처</td>
<td height="35" colspan="3" align="center">최진기 (인)</td>
</tr>
</table></td>
</tr>
<tr>
<td height="35" align="center" valign="bottom"><span style="font-weight: bold; font-size: 18px;">진해장애인자립생활센터</span></td>
</tr>
</table>
<!-- 개인별 상담 기록지 폼 끝--><!-- } 본문 내용 끝 -->
<?php if ($is_signature) { ?>
<p><?php echo $signature ?></p><?php } ?>
</div>
</div>
<!-- 추천 비추천 시작 { -->
<?php if ( $good_href || $nogood_href) { ?>
<div id="bo_v_act">
<?php if ($good_href) { ?>
<span class="bo_v_act_gng">
<a href="<?php echo $good_href.'&'.$qstr ?>" id="good_button" class="bo_v_good"><i class="fa fa-thumbs-o-up" aria-hidden="true"></i><span class="sound_only">추천</span><strong><?php echo number_format($view['wr_good']) ?></strong></a>
<b id="bo_v_act_good"></b>
</span>
<?php } ?>
<?php if ($nogood_href) { ?>
<span class="bo_v_act_gng">
<a href="<?php echo $nogood_href.'&'.$qstr ?>" id="nogood_button" class="bo_v_nogood"><i class="fa fa-thumbs-o-down" aria-hidden="true"></i><span class="sound_only">비추천</span><strong><?php echo number_format($view['wr_nogood']) ?></strong></a>
<b id="bo_v_act_nogood"></b>
</span>
<?php } ?>
</div>
<?php } else {
if($board['bo_use_good'] || $board['bo_use_nogood']) {
?>
<div id="bo_v_act">
<?php if($board['bo_use_good']) { ?><span class="bo_v_good"><i class="fa fa-thumbs-o-up" aria-hidden="true"></i><span class="sound_only">추천</span><strong><?php echo number_format($view['wr_good']) ?></strong></span><?php } ?>
<?php if($board['bo_use_nogood']) { ?><span class="bo_v_nogood"><i class="fa fa-thumbs-o-down" aria-hidden="true"></i><span class="sound_only">비추천</span><strong><?php echo number_format($view['wr_nogood']) ?></strong></span><?php } ?>
</div>
<?php
}
}
?>
<!-- } 추천 비추천 끝 -->
</section>
<?php
$cnt = 0;
if ($view['file']['count']) {
for ($i=0; $i<count($view['file']); $i++) {
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view'])
$cnt++;
}
}
?>
<?php if($cnt) { ?>
<!-- 첨부파일 시작 { -->
<section id="bo_v_file">
<h2>첨부파일</h2>
<ul>
<?php
// 가변 파일
for ($i=0; $i<count($view['file']); $i++) {
if (isset($view['file'][$i]['source']) && $view['file'][$i]['source'] && !$view['file'][$i]['view']) {
?>
<li>
<i class="fa fa-folder-open" aria-hidden="true"></i>
<a href="<?php echo $view['file'][$i]['href']; ?>" class="view_file_download" download>
<strong><?php echo $view['file'][$i]['source'] ?></strong> <?php echo $view['file'][$i]['content'] ?> (<?php echo $view['file'][$i]['size'] ?>)
</a>
<br>
<span class="bo_v_file_cnt"><?php echo $view['file'][$i]['download'] ?>회 다운로드 | DATE : <?php echo $view['file'][$i]['datetime'] ?></span>
</li>
<?php
}
}
?>
</ul>
</section>
<!-- } 첨부파일 끝 -->
<?php } ?>
<?php if(isset($view['link'][1]) && $view['link'][1]) { ?>
<!-- 관련링크 시작 { -->
<section id="bo_v_link">
<h2>관련링크</h2>
<ul>
<?php
// 링크
$cnt = 0;
for ($i=1; $i<=count($view['link']); $i++) {
if ($view['link'][$i]) {
$cnt++;
$link = cut_str($view['link'][$i], 70);
?>
<li>
<i class="fa fa-link" aria-hidden="true"></i>
<a href="<?php echo $view['link_href'][$i] ?>" target="_blank">
<strong><?php echo $link ?></strong>
</a>
<br>
<span class="bo_v_link_cnt"><?php echo $view['link_hit'][$i] ?>회 연결</span>
</li>
<?php
}
}
?>
</ul>
</section>
<!-- } 관련링크 끝 -->
<?php } ?>
<?php if ($prev_href || $next_href) { ?>
<ul class="bo_v_nb">
<?php if ($prev_href) { ?><li class="btn_prv"><span class="nb_tit"><i class="fa fa-chevron-up" aria-hidden="true"></i> 이전글</span><a href="<?php echo $prev_href ?>"><?php echo $prev_wr_subject;?></a> <span class="nb_date"><?php echo str_replace('-', '.', substr($prev_wr_date, '2', '8')); ?></span></li><?php } ?>
<?php if ($next_href) { ?><li class="btn_next"><span class="nb_tit"><i class="fa fa-chevron-down" aria-hidden="true"></i> 다음글</span><a href="<?php echo $next_href ?>"><?php echo $next_wr_subject;?></a> <span class="nb_date"><?php echo str_replace('-', '.', substr($next_wr_date, '2', '8')); ?></span></li><?php } ?>
</ul>
<?php } ?>
<?php
// 코멘트 입출력
include_once(G5_BBS_PATH.'/view_comment.php');
?>
</article>
<!-- } 게시판 읽기 끝 -->
<script>
<?php if ($board['bo_download_point'] < 0) { ?>
$(function() {
$("a.view_file_download").click(function() {
if(!g5_is_member) {
alert("다운로드 권한이 없습니다.\n회원이시라면 로그인 후 이용해 보십시오.");
return false;
}
var msg = "파일을 다운로드 하시면 포인트가 차감(<?php echo number_format($board['bo_download_point']) ?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?";
if(confirm(msg)) {
var href = $(this).attr("href")+"&js=on";
$(this).attr("href", href);
return true;
} else {
return false;
}
});
});
<?php } ?>
function board_move(href)
{
window.open(href, "boardmove", "left=50, top=50, width=500, height=550, scrollbars=1");
}
</script>
<script>
$(function() {
$("a.view_image").click(function() {
window.open(this.href, "large_image", "location=yes,links=no,toolbar=no,top=10,left=10,width=10,height=10,resizable=yes,scrollbars=no,status=no");
return false;
});
// 추천, 비추천
$("#good_button, #nogood_button").click(function() {
var $tx;
if(this.id == "good_button")
$tx = $("#bo_v_act_good");
else
$tx = $("#bo_v_act_nogood");
excute_good(this.href, $(this), $tx);
return false;
});
// 이미지 리사이즈
$("#bo_v_atc").viewimageresize();
});
function excute_good(href, $el, $tx)
{
$.post(
href,
{ js: "on" },
function(data) {
if(data.error) {
alert(data.error);
return false;
}
if(data.count) {
$el.find("strong").text(number_format(String(data.count)));
if($tx.attr("id").search("nogood") > -1) {
$tx.text("이 글을 비추천하셨습니다.");
$tx.fadeIn(200).delay(2500).fadeOut(200);
} else {
$tx.text("이 글을 추천하셨습니다.");
$tx.fadeIn(200).delay(2500).fadeOut(200);
}
}
}, "json"
);
}
</script>
<!-- } 게시글 읽기 끝 -->
답변 1
css 를 불러오지 못하는 문제라서 간단히 해결하는 방법은
해당 부분에 style 을 추가해주세요.
style="line-height:130%;"
<td height="46" colspan="5" valign="top" style="line-height:130%;"><p>※ 6하 원칙으로 해서 기록해주세요. (누가, 언제, 어디서, 무엇을, 어떻게, 왜)<br />
<br />
<?php echo get_view_thumbnail($view['content']); ?>
<?php //echo $view['rich_content']; // view_image($view, '0', '') 과 같은 코드를 사용할 경우 ?>
<br />
</p></td>