【问题标题】:DOMPDF problems with special character like Hebrew language具有特殊字符(如希伯来语)的 DOMPDF 问题
【发布时间】:2019-06-14 00:30:07
【问题描述】:

我正在尝试使用希伯来语,但它显示 ???????而不是希伯来语内容。如果有人建议。谢谢

    require  'dompdf/autoload.inc.php';

    $html   = empty( $html ) ? $this->get_order_pdf_html( $order_id, 'pdf' ) : $html;

    $dompdf = new Dompdf( array(
        'isRemoteEnabled' => true,
    ) );

    $dompdf->setPaper( 'A4', 'portrait' ); 
    $dompdf->set_option('isHtml5ParserEnabled', true);
    $dompdf->loadHtml( $html, 'UTF-8' ); 
    $dompdf->render(); 

    $output = $dompdf->output(); 

    if( $save_pdf ) {

        $invoice_file_name = sprintf( '%s/uploads/document-%s-%s.pdf', WP_CONTENT_DIR, $order_id, time("H:s") );
        file_put_contents( $invoice_file_name, $output);
        return $invoice_file_name;
    }

    if( $download_pdf ) {

        $dompdf->stream( sprintf( "%s-%s", __('document'), $order_id ) );
        return true;
    }

    return $output;
}

【问题讨论】:

  • 您没有显示任何与文档相关的 HTML。我们需要先看到这一点,然后才能确定问题是出在 Dompdf 还是其他问题上。你读过Unicode How-to吗?

标签: utf-8 pdf-generation dompdf


【解决方案1】:

字体家族:萤火虫,DejaVu Sans,无衬线; 在你的希伯来字母包含元素中使用这个字体农场。 祝你好运

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-05
    相关资源
    最近更新 更多