1

I am trying to use the class htmltodoc in order to create a .pdf from an html page with : http://www.phpkode.com/source/s/html-to-doc-classes/html-to-doc-classes/html_to_doc.inc.php

And with the library LiveDocx (with Zend) : http://srhwd.com/documentation/moodle/_mail_merge_8php_source.html

without creating a .doc . Here is my code :

$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;

But it returns:

Error HTTP 500 (Internal Server Error)

Can someone help me please ?

hakre
  • 193,403
  • 52
  • 435
  • 836
RomainHM
  • 13
  • 5
  • I have to change $mailMerge->setLocalTemplate($htmltodoc) with something but I don't really know what =( – RomainHM Apr 24 '12 at 12:30

1 Answers1

1

If you want to convert HTML to PDF you could use a PDF lib such as :

adrien
  • 4,399
  • 26
  • 26
  • Thank you Adrien, I will try dompdf if I don't manage to fix my problem. But do you have an idea to fix it ? – RomainHM Apr 24 '12 at 16:19
  • You should try to fetch the actual error : when Apache says "Error HTTP 500" you must go to PHP error logs and you will see a more detailed error message. – adrien Apr 24 '12 at 16:58
  • Thank you all, dompdf is very simple and efficient ! =) – RomainHM Apr 25 '12 at 14:08