title: Converting DOCX to PDF with PHPWord and DomPDF
body: <p>I'm running a web only server (So no server access and no things like Composer or LibreOffice) and I want to convert a DOCX template to PDF. I have succesfully processed my template with PHPWord (Downloaded using php-download.com since I can't use composer), everything fine there, but when I try to use DomPDF (also downloaded through phpdownload) to convert my docx file to a PDF file, PHP throws me "Class 'Dompdf\Dompdf' not found"...</p>
  
  <p>I created a seperate file to just convert an already known docx file just to exclude any environmental issues</p>
  
  <p>This is my code:</p>
  
  <pre><code>require_once("includes/PHPWord/vendor/autoload.php");
  
  $inputfile = "files/temp/offerte_Hankie-Pankie.docx";
  
  $path = realpath(realpath(__DIR__) . '/includes/dompdf');
  
  echo "realpath: " . $path;
  
  \PhpOffice\PhpWord\Settings::setPdfRendererPath($path);
  \PhpOffice\PhpWord\Settings::setPdfRendererName(\PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF);
  
  //Load temp file
  $phpWord = \PhpOffice\PhpWord\IOFactory::load($inputfile); 
  
  //Save it
  $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
  $xmlWriter-&gt;save('result.pdf');
  </code></pre>
  
  <p>Using the echo I confirmed the folder is set properly: "/home/myusername/domains/mydomain.nl/public_html/projects/pdftemplate/includes/dompdf"</p>
  
  <p>So i tried parsing the subfolders "src" or "lib" without success, I tried parsing the actual autoloader file "autoload.inc.php" and didn't work either. I tried all of the above paths with and without ending "/" (Just to be sure) and still class not found... Even though I'm using exact copies of code found to be (presumably) working on the internet.</p>
  
  <p>I tried finding it in the PHPWord documentation, which didn't give me any solutions. I also tried excluding PHPWord and just using DomPDF, but since DomPDF only accepts html as input, and I don't know how (And didn't want spend another hour trying that) to convert docx to HTML, this was also a dead end.</p>
  
  <p>Just as a reference, here is my file structure:</p>
  
  <ul>
  <li>Work dir
  
  <ul>
  <li>CodeIsInThisFile.php</li>
  <li>includes
  
  <ul>
  <li>dompdf</li>
  <li>lib</li>
  <li>src
  
  <ul>
  <li>Autoloader.php</li>
  </ul></li>
  <li>autoloader.inc.php</li>
  <li>PHPWord</li>
  <li>vendor
  
  <ul>
  <li>autoload.php</li>
  </ul></li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>So either I messed something up in my file structure because of the manual downloads (Which seems the most likely to me), or my code is wrong (Also likely)...</p>