title: Embedding PDF documents generated with DOCPDF in CodeIgniter
body: <p>I am trying to convert set up a CodeIgniter application which can take a .docx document, and using DOCPDF (<a href="https://github.com/dompdf/dompdf" rel="nofollow">https://github.com/dompdf/dompdf</a>), convert it to a pdf, and embed that pdf file in my view.  In my controller, I already can convert the .docx document, however, the only way I can do that is to have it generate a file that is automatically downloaded.</p>
  
  <p>Is there a way in which I can send the file to my view so that it can be embedded?  Or maybe, temporarily retain the file in a buffer or something, that I can then use as the source of my embed tags in my view?  I am quite new at all of this, so I feel I might be missing something easy. </p>
  
  <p>Here is what I have tried so far...</p>
  
  <p>My controller method used:</p>
  
  <pre><code>public function resume_viewer()
  {
      error_reporting(E_ALL);
      $pageSettings['module'] = 4;
      $pageSettings['subModule'] = 0;
      $data['pageSettings'] = $pageSettings;
  
      $this-&gt;load-&gt;library('docx_reader');
      $this-&gt;load-&gt;helper(array('dompdf', 'file'));
  
      $doc = new Docx_reader();
      $doc-&gt;setFile('testDoc3.docx');
  
      $plain_text = $doc-&gt;to_plain_text();
      $html = $doc-&gt;to_html();
  
      $pdf = pdf_create($html, 'testDoc4', false);
  
      $data['html'] = $html;
      $testEvents = explode("'", $this-&gt;input-&gt;post('testEventIds'));
  
      $data['testEvents'] = $testEvents;
  
      $this-&gt;load-&gt;view('results/resume_viewer', $data);
  }
  </code></pre>
  
  <p>My HTML in the view:</p>
  
  <pre><code>&lt;div id="magazine" class="text-center"&gt;
      &lt;div&gt;
          &lt;h1 style="margin-left: -350px;"&gt;Gerald Cunningham&lt;/h1&gt;
          &lt;embed src="my-pdf-file-here" width="600" height="775" alt="pdf" pluginspage="http://www.adobe.com/products/acrobat/readstep2.html"&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>What I don't know is how to get the converted pdf file into the embed tag there. Any help is greatly appreciated!</p>
  
  <p>Thanks ahead of time!</p>