Forum How do I...?

Trouble using Prince with PHP

tatonweb
Hello,
I have tried to use Prince with PHP trying to translate an html document to a pdf document, but it does not work at all.
It says "Prince instantiation OK" and nothing more happens.
I get the message : "sh: : command not found".

Here is my code :
 <?php 
include_once "prince.php";
//---------------------------------
// lecture du fichier html et traduction en PDF
//-------------------------------------------
$filetosend="export.pdf";
$filename="/modeles/classique_html.html";

$msgs=array();
$dats=array();
   $prince=new Prince('');
   
   if(!$prince) die("<p>Prince instantiation failed</p>");
else echo "Prince instantiation OK<br />";

   $prince->setHTML(1);
   $prince->setLog('prince.log');
   $ok=$prince->convert_file_to_file($filename,$filetosend, $msgs, $dats);
   if ($ok)    echo "fichier cree"; else echo "erreur de creation du fichier";
?>

Thanks for your help.
Best regards
mikeday
When calling "new Prince" you need to pass the full path to the Prince shell script on the server, for example "/usr/bin/prince" if Prince is installed in the standard location.
tatonweb
Hi, thanks for your answer.
I probably missed something!
I put prince.php in the same directory as my program. It does tell me there is a prince instantiation and I can even print it, but it does not translate.
I put the full path of my program but it does not change anything.

In local I tryed with wampserver and this time the error is :
Failed to execute "F:/wamp/www/E-formaclic/testword" -i "html" --no-xinclude --log="prince.log" --verbose --structured-log=normal "modeles/classique_html.html" in F:\wamp\www\E-formaclic\testword\prince.php on line 1000

Is there another way to install Prince than copying the prince.php?
Best regards
mikeday
Yes, you need to download the software and install it on the server, the PHP class is just a wrapper for it.
tatonweb
Fine, it works!
Thanks a lot for your help