title: Woocommerce HTML2PDF send pdf
body: <p>I've create a website for selling training. After buying,I would like to send a notification to the customer who ordering the product.
  So, i choose to use HTML2PDF to create a dynamic pdf, with a plugin.
  But i failed to link the pdf to the mail invoice. Nevertheless the billing form work fine</p>
  
  <p>I use the hook to add the pdf to grap the email after processing order. The submition</p>
  
  <pre><code>require __DIR__.'/vendor/autoload.php';
  
  use Spipu\Html2Pdf\Html2Pdf;
  
  
  add_filter('woocommerce_email_attachments', 'attach_terms_conditions_pdf_to_email', 10,  3);
  
  function attach_terms_conditions_pdf_to_email ( $attachments, $status ,  $order ) {
  
      $allowed_statuses = array('customer_processing_order');
      if( isset( $status ) &amp;&amp; in_array ( $status, $allowed_statuses ) ) {
          $html2pdf = new Html2Pdf();
          $html2pdf-&gt;writeHTML('&lt;h1&gt;HelloWorld&lt;/h1&gt;This is my first test');
  
          $files=$html2pdf-&gt;output('convocation.pdf','S');
          $attachments[] = $files;
      }
      return $attachments;
  }
  </code></pre>
  
  <p>Thanks for yours reply </p>