我使用TFPDF php库创建了一个pdf文件。我在pdf中添加了一些印地语文本。只有那个印地文文字在pdf中不可见(白色)。我尝试过改变颜色,但仍然看不到它。
以下是我使用的代码
<?php
// Optionally define the filesystem path to your system fonts
// otherwise tFPDF will use [path to tFPDF]/font/unifont/ directory
// define("_SYSTEM_TTFONTS", "C:/Windows/Fonts/");
require('tfpdf.php');
$pdf = new tFPDF();
$pdf->AddPage();
// Add a Unicode font (uses UTF-8)
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
$pdf->SetFont('DejaVu','',14);
// Load a UTF-8 string from a file and print it
$txt = file_get_contents('HelloWorld.txt');
$pdf->SetTextColor(153,0,153);
$pdf->Write(8,$txt);
// Select a standard font (uses windows-1252)
$pdf->SetFont('Arial','',14);
$pdf->Ln(10);
$pdf->Output();
?>
HelloWorld.txt包含
English: Hello World
Greek: Γειά σου κόσμος
Polish: Witaj świecie
Portuguese: Olá mundo
Russian: Здравствулте мир
Vietnamese: Xin chào thế giới
वैशेषिक दर्शन में मन विषयक विश्लेषण
输出
如果我选择文字,那么只有印地文可见