生成PDF,用戶可打印(PDF格式)他接受 由於某種原因,NDA我不能顯示PDF不能與我的網站上TCPDF
這裏的邏輯
第一改寫規則
.htaccess
RewriteRule ^nda/?$ ndapdf.php?useSessionUser=1 [L]
那麼php
<?php
$html = file_get_contents("/lib/nda.txt");
$html = str_replace("##user##", $_SESSION["currentUser"]);
$html = str_replace("##date##", date("Y-m-d h:i:s"));
require("/lib/web/tcpdf/config/lang/eng.php");
require("/lib/web/tcpdf/tcpdf.php");
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, "UTF-8", false);
$pdf->SetCreator("mysite");
$pdf->SetAuthor("author_name");
$pdf->SetTitle("NDA");
$pdf->SetSubject("Accepted NDA");
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, "", PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, "", PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setLanguageArray(array("w_page" => ""));
$fontname = $p->addTTFfont("/fonts/AveriaSans-light.ttf", "TrueTypeUnicode", "", 32);
$pdf->SetFont("arial", "", 10);
$pdf->AddPage();
$pdf->writeHTML($html, true, false, true, false, "");
$pdf->lastPage();
$pdf->Output("/home/comp/pdf/nda/$currentUser.pdf", "F");
header("Content-Type: application/pdf\n");
read("/home/comp/pdf/nda/$currentUser.pdf");
我得到:
「TCPDF錯誤:無法包括字體定義文件:AveriaSans光」
的字體:LL /字體/
-rw-r--r-- 1 root root 85084 2011-11-02 17:51 AveriaSans-Light.ttf
感謝
壞的複製和粘貼 –