title: Doc to PDF with PHP + Openoffice
body: <p>I am trying to follow a tutorial on converting doc to pdf using openoffice. I have the following code:</p>
  
  <pre><code>&lt;?php
  set_time_limit(0); 
  function MakePropertyValue($name, $value,$osm){ 
     $oStruct = $osm-&gt;Bridge_GetStruct("com.sun.star.beans.PropertyValue"); 
     $oStruct-&gt;Name = $name; 
     $oStruct-&gt;Value = $value; 
     return $oStruct; 
  } 
  function word2pdf($doc_url, $output_url){ 
     // Invoke the OpenOffice.org service manager 
     $osm = new COM("com.sun.star.ServiceManager") or die ("Please be sure that OpenOffice.org is installed.\n"); 
     // Set the application to remain hidden to avoid flashing the document onscreen 
     $args = array(MakePropertyValue("Hidden",true,$osm)); 
     // Launch the desktop 
     $top = $osm-&gt;createInstance("com.sun.star.frame.Desktop"); 
     // Load the .doc file, and pass in the "Hidden" property from above 
     $oWriterDoc = $top-&gt;loadComponentFromURL($doc_url,"_blank", 0, $args); 
     // Set up the arguments for the PDF output 
     $export_args = array(MakePropertyValue("FilterName","writer_pdf_Export",$osm)); 
     // Write out the PDF 
     $oWriterDoc-&gt;storeToURL($output_url,$export_args); 
     $oWriterDoc-&gt;close(true); 
  } 
  $output_dir = './'; 
  $doc_file = './test.docx'; 
  $pdf_file = 'DpmR5Reqv1.20.pdf'; 
  $output_file = $output_dir . $pdf_file; 
  $doc_file = 'file:///' . $doc_file; 
  $output_file = 'file:///' . $output_file; 
  word2pdf($doc_file,$output_file); 
  ?&gt;
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `com.sun.star.ServiceManager' in C:\wamp\www\Projects\doc_to_pdf\index.php on line 11
  ( ! ) com_exception: Failed to create COM object `com.sun.star.ServiceManager': Invalid syntax in C:\wamp\www\Projects\doc_to_pdf\index.php on line 11
  </code></pre>
  
  <p>Ive tried to what this tutorial suggests: <a href="http://puno.ayun.web.id/2009/08/php-ooo-in-microsoft-windows-environment/" rel="nofollow">http://puno.ayun.web.id/2009/08/php-ooo-in-microsoft-windows-environment/</a> But no luck. Any idea what I can do? I am running this under wamp and it will be ran under wamp in production.</p>