안녕하세요ㅠㅠ pdf 관련.. 채택완료
tich
9년 전
조회 5,307
안녕하세요. 여기 개발자 분들이 많으셔서 질문드려봅니다ㅠㅠ
워드프레스로 홈페이지 개발중인데요..
플러그인중에 db를 pdf로 export 시키는 게 있어요
근데 이게 한글이 모두 물음표로 출력되어 깨지네요..........ㅠ^ㅠ
-----------------------------customizing---------------------------------
<?php
/**
* PDF Included With Form Submission
*
* @author Patrick Rauland
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" href="pdf.css" rel="stylesheet" />
</head>
<body>
안녕하세요.
<h1><?php echo $title; ?></h1>
<?php echo $table; ?>
</body>
</html>
----------------------------------------------------------------------
---------------------------export pdf -----------------------------------
<?php
define("NF_PDF_TEMPLATE_URL", apply_filters( 'nf_pdf_template_url', 'ninja-forms-pdf-submissions/' ) );
/**
* Get other templates passing attributes and including the file.
*
* @access public
* @param mixed $template_name
* @param array $args (default: array())
* @param string $template_path (default: '')
* @param string $default_path (default: '')
* @return void
*/
function nf_pdf_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
if ( $args && is_array($args) ) {
extract( $args );
}
$located = nf_pdf_locate_template( $template_name, $template_path, $default_path );
do_action( 'nf_pdf_before_template_part', $template_name, $template_path, $located, $args );
include( $located );
do_action( 'nf_pdf_after_template_part', $template_name, $template_path, $located, $args );
}
/**
* Locate a template and return the path for inclusion.
*
* This is the load order:
*
* yourtheme / $template_path / $template_name
* yourtheme / $template_name
* $default_path / $template_name
*
* @access public
* @param mixed $template_name
* @param string $template_path (default: '')
* @param string $default_path (default: '')
* @return string
*/
function nf_pdf_locate_template( $template_name, $template_path = '', $default_path = '' ) {
// set a default template directory url
if ( ! $template_path ) {
$template_path = NF_PDF_TEMPLATE_URL;
}
if ( ! $default_path ) {
$default_path = NF_PDF_TEMPLATE_URL . '/templates/';
}
// Look within passed path within the theme - this is priority
$template = locate_template(
array(
trailingslashit( $template_path ) . $template_name, $template_name
)
);
// Get default template if we couldn't find anything in the theme
if ( ! $template ) {
$template = $default_path . $template_name;
}
// Return what we found
return apply_filters( 'nf_pdf_locate_template', $template, $template_name, $template_path );
}
--------------------------------------------------------------------
-----------------------css-------------------------------------------
@import url(http://fonts.googleapis.com/earlyaccess/nanumgothic.css);">http://fonts.googleapis.com/earlyaccess/nanumgothic.css);
table {
border-collapse: collapse;
font-family: 'Nanum Gothic', sans-serif;
width: 100%;
}
table, th, td {
border: 1px solid black;
padding: .5em;
}
table tr:nth-child(even) {
background-color: #DDD;
}
--------------------------------------------------------------------------------
좀 도와주실 수 있을까요ㅠㅠ
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
답변에 대한 댓글 1개
t
tich
9년 전
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
pdf에서만 오류가 생기네요.. 제가볼땐 pdf로 저장시 pdf 기본 폰트가 영문이라 깨지는 것 같은데.. ㅠㅠ
pdf저장 시 폰트를 지정해주는 코드 같은건 없을까요? ㅜㅜ