douyoupingji7238 2015-05-25 09:10
浏览 25

DOMPDF Wordpress没有任何反应

I have a problem with DOMPDF integration into Wordpress.

Here are the steps done:

  1. Installed DOMPDF 0.6.1 into the themedir/dompdf/
  2. Created path /dompdf/lib/php-font-lib/classes where php lib is to be imported
  3. Imported the "FontLib" folder contents (version 0.4) into the /dompdf/lib/php-font-lib/classes

Here is the code:

    require_once(echo get_template_directory_uri()."/dompdf/dompdf_config.inc.php");

$html =
  '<html><body>'.
  '<p>Put your html here, or generate it with your favourite '.
  'templating system.</p>'.
  '</body></html>';

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream(echo get_template_directory_uri()."/dompdf/testpdf.pdf");

Outputs nothing, I have also tried stream("testpdf.pdf"); as the last line but no success.

Any ideas? Thank you.

  • 写回答

1条回答 默认 最新

  • doule6314 2015-06-19 01:45
    关注

    Try this

    include get_template_directory() . '/dompdf/dompdf_config.inc.php';
    
    $html =
      '<html><body>'.
      '<p>Put your html here, or generate it with your favourite '.
      'templating system.</p>'.
      '</body></html>';
    
    $dompdf = new DOMPDF();
    $dompdf->load_html( $html );
    $dompdf->render();
    file_put_contents( get_template_directory() . "/dompdf/testpdf.pdf");
    
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥15 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)