Question

I cannot get PrinceXML to work on my Windows Server. I am using the PHP wrapper class, although am unable to find any helpful documentation for it!

The information supplied in the README file (within the download) here does not explain what is being done, nor does it offer any sample code.

This is what I have put together so far (very basic), but nothing is being printed, and no errors are being displayed.

I know that I have not included header('PDF HEADERS HERE'), this is simply because I am trying to see what the PHP errors are before I print the PDF.

$prince = new Prince('C:\Program Files (x86)\Prince\Engine\bin\prince.exe');

try{
    $prince->convert_string_to_file('<span>Hello World</span>','test.pdf');
} catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}

I have played around a lot with the above code but absolutely nothing I have tried is work. Even if I change the path to the prince.exe, no error is returned! Why??

My questions are:

  1. How can I print the errors that are encountered?
  2. Are there any sites with good documentation for this class?
Was it helpful?

Solution

Call $prince->setLog(path_to_log_file) and make sure that the specified log file path is writable from your PHP code.

OTHER TIPS

just give full path here

$prince->convert_string_to_file('Hello World','D:\testfolder\test.pdf');

thats all you can get your test.pdf in d drive test folder

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top