html2pdf中的CP1251编码问题

我从以下网址下载并设置了脚本:http://www.html2pdf.fr/en 它使用默认编码工作正常,但是当我尝试使用CP-1251中的字符生成文档时,我得到的是空格而不是字符。 还有我在CP-1251中的所有文件,CP-1251中的数据,你可以看到我使用简单的字体-Arial 请,可能存在一些解决方案,让它工作。 P / s对不起我的英语
    ob_start();

include(dirname(__FILE__).'/res/exemple00.php');

$content = ob_get_clean();

require_once(dirname(__FILE__).'/../html2pdf.class.php');

try

{

    $html2pdf = new HTML2PDF('P','A4','fr');

    $html2pdf->setDefaultFont('Arial');

    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));

    $content1=$html2pdf->Output('', 'S');
//一些PHP代码
    $db->query("set names cp1251");

$query="SELECT data from files Where id=$file_id ";

$result=$db->query($query);

    $row=$result->fetch_assoc();

$content=($row['data']);
标题('Content-Type:application / pdf'); header(“Content-Length:”。。strlen(content)); header('Content-Disposition:attachment; filename = Invoice#'。$ invoice_id。'。pdf'); 打印$ content;
}

catch(HTML2PDF_exception $e) { echo $e; }    enter code here
    
已邀请:
我没有使用这个库,但你在HTML2PDF构造函数中设置编码吗?
    $html2pdf = new HTML2PDF('P','A4','fr', true, 'CP-1251');
如果它不起作用,请尝试'cp1251'或'CP1251',我在文档中找不到已识别编码的列表。您也可以使用iconv并转换为UTF-8,因为它似乎是默认值。     

要回复问题请先登录注册