1

我正在尝试使用 htmltodoc 类从 html 页面创建 .pdf: http ://www.phpkode.com/source/s/html-to-doc-classes/html-to-doc-classes /html_to_doc.inc.php

并使用库 LiveDocx(使用 Zend): http ://srhwd.com/documentation/moodle/_mail_merge_8php_source.html

无需创建 .doc 。这是我的代码:

$htmltodoc= new HTML_TO_DOC();

$htmltodoc->createDocFromURL("http://www.youtube.com/","google.doc",false);

$mailMerge = new Zend_Service_LiveDocx_MailMerge(
    array (
        'username' => 'xxxxxxx',
        'password' => 'xxxxxxx'
    )
);

$mailMerge->setLocalTemplate($htmltodoc);

//$mailMerge->setLocalTemplate('template.doc'); Normally, template.doc is registered on server

$mailMerge->createDocument();

$document = $mailMerge->retrieveDocument('pdf');

header('Content-disposition: attachment; filename=document.pdf');

header('Content-type: application/pdf');

echo $document;

但它返回:

错误 HTTP 500(内部服务器错误)

有人能帮助我吗 ?

4

1 回答 1

1

如果要将 HTML 转换为 PDF,可以使用 PDF 库,例如:

于 2012-04-24T15:50:54.590 回答