各位大大好:
主要是產生畫面的同時,直接在server端存一個pdf並寄送到信箱(PHPmailer 程式我沒放上來)
只要function fetch_customer_data1()中的程式碼過多就會遮住原來的程式碼的最下面
但是只要把tcpdf程式碼清掉,function fetch_customer_data1()程式碼不改,留著就也會正常
還想請問PHPmailer標題跟內容要怎麼用中文(只有英文不會亂碼)呢?
請問有甚麼方法可以解決呢? 謝謝
<body>
//原程式碼
function fetch_customer_data1(){
//產生pdf的程式碼;
}
<?php
require_once('tcpdf/tcpdf.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 002');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT-5, PDF_MARGIN_TOP-25, PDF_MARGIN_RIGHT-5);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE,-10);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
/*if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}*/
// set font
$pdf->SetFont('msungstdlight', '', 20);
// add a page
$pdf->AddPage();
// set some text to print
$content = '';
$content .= fetch_customer_data1() ;
// print a block of text using Write()
$pdf->writeHTMLCell(0, 0, '', '', $content, 0, 1, 0, true, '', true);
// ---------------------------------------------------------
//Close and output PDF document
ob_end_clean();
$attachement=$pdf->Output(__DIR__ .'/upload/power2019-'.$VIDStrlast.'.pdf', 'F');
?>
<body>