简体   繁体   English

DOMPDF Wordpress没有任何反应

[英]DOMPDF Wordpress nothing happens

I have a problem with DOMPDF integration into Wordpress. 我将DOMPDF集成到Wordpress中时遇到问题。

Here are the steps done: 这是完成的步骤:

  1. Installed DOMPDF 0.6.1 into the themedir/dompdf/ DOMPDF 0.6.1安装到themedir / dompdf /
  2. Created path /dompdf/lib/php-font-lib/classes where php lib is to be imported 创建路径/ dompdf / lib / php-font-lib / classes,其中要导入php lib
  3. Imported the "FontLib" folder contents ( version 0.4 ) into the /dompdf/lib/php-font-lib/classes 将“ FontLib”文件夹内容( 版本0.4 )导入到/ 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"); 什么都不输出,我也尝试过stream(“ testpdf.pdf”); as the last line but no success. 作为最后一行,但没有成功。

Any ideas? 有任何想法吗? Thank you. 谢谢。

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");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM