title: Zend framework 3 - DOMPDF
body: <p>I'm trying to use DOMPDF module with ZF 3. </p>
  
  <p>I've installed it with composer <code>composer require dino/dompdf-module</code> and looks ok.</p>
  
  <p><a href="https://i.stack.imgur.com/UyN16.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UyN16.png" alt="Installation via composer"></a>
  <p>Then i've imported the dompdf module to my order controller</p>
  
  <pre><code>use DOMPDFModule\View\Model\PdfModel;
  </code></pre>
  
  <p>After that, i've created a new action called printOrderPdfAction() and a new view, here's the following code:</p>
  
  <p>Controller:</p>
  
  <pre><code>public function printOrderPdfAction()
  {
      $this-&gt;layout(FALSE);
  
      $pdf = new PdfModel();
      $pdf-&gt;setOption('filename', 'order-pdf');
      $pdf-&gt;setOption('paperSize', 'a4');
      $pdf-&gt;setOption('paperOrientation', 'portrait');
  
      $pdf-&gt;setVariables([
          'message' =&gt; 'This is a test message'
      ]);
  
      return $pdf;
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;h2&gt;&lt;?= $this-&gt;message?&gt;&lt;/h2&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This should download automatically the pdf, however it's returning the view and it's not downloading the pdf file.</p>
  
  <p>Like this:<a href="https://i.stack.imgur.com/NQLQS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NQLQS.png" alt="enter image description here"></a></p>
  
  <p>Anyone can help me to solve this?</p>