title: Cakepdf generating PDF View
body: <p>I have a problem with Cakepdf. I can generate .pdfs to my server, but can´t view them in my browser.</p>
  
  <pre><code>$CakePdf = new \CakePdf\Pdf\CakePdf();
  $CakePdf-&gt;template('view', 'default');
  $CakePdf-&gt;viewVars($this-&gt;viewVars);
  // Get the PDF string returned
  $pdf = $CakePdf-&gt;output();
  echo $pdf;
  </code></pre>
  
  <p>Just gives me cryptic code like</p>
  
  <pre><code>%PDF-1.3 1 0 obj &lt;&lt; /Type /Catalog /Outlines 2 0 R /Pages 3 0 R &gt;&gt; endobj 2 0 obj &lt;&lt; /Type /Outlines /Count 0 &gt;&gt; endobj 3 0 obj &lt;&lt; /Type /Pages /Kids [6 0 R 14 0 R ] /Count 2 /Resources &lt;&lt; /ProcSet 4 0 R /Font &lt;&lt; /F1 8 0 R /F2 9 0 R &gt;&gt; /XObject &lt;&lt; /I1 12 0 R /I2 13 0 R /I3 18 0 R /I4 19 0 R &gt;&gt; &gt;&gt; /MediaBox [0.000 0.000 595.280 841.890] &gt;&gt; endobj 4 0 obj [/PDF /Text /ImageC ] endobj 5 0 obj &lt;&lt; /Creator (DOMPDF) /CreationDate (D:20160208165451+00'00') /ModDate (D:20160208165451+00'00') &gt;&gt; endobj 6 0 obj &lt;&lt; /Type /Page /Parent 3 0 R /Annots [ 10 0 R ] /Contents 7 0 R &gt;&gt; endobj 7 0 obj &lt;&lt; /Filter /FlateDecode /Length 819 &gt;&gt; stream x�}Uˎ�8��+������`O�d$H�&lt;��,�@K�M�5|L�|}���� �-QbwUuus�眶�����HuÚ��ڪc5/�8����t&lt;���g9�Ɂ��p�A�Eԁ��ncx�����M�������"���HEnW]��k�.�Z�;~�������(}xo�4�&amp; V[G^F�=�v�� C��Ġ&amp;�{5^Hj}�ɝ���6� ����rp��U��bUQd�h䊞�u��iP�є� ڀe�'��T��'/��B��K'&lt;@J#�Z94e�ʮLh V�u��%�B�rD\�.Q2�{���0��K3A&amp;hv�rO2*o��О�b��Y5f�k*�`i�2�e�$AͪX׫�=��|'c5ʨR�Z�:QWg�y�s��ҭZ$2Y�,jM}װ��KhJVWUM*I'��W`�2_o����8���&gt;JzPA��R�QR�er2(�»9(]ɪ�Y�)rN�!�����h)��)�bNz�:� I�:Igi� dv�����t_�`�'�C�����JX�c{{{���:�qK�m&gt;�O�5Ku��6a�X%�?f�2V 2n �$� kڸ�o��y����_�Y� endstream endobj xref 0 20 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000351 00000 n 0000000388 00000 n 0000000502 00000 n 0000000584 00000 n 0000001475 00000 n 0000001587 00000 n 0000001694 00000 n 0000001821 00000 n 0000001895 00000 n 0000002860 00000 n 0000003940 00000 n 0000004024 00000 n 0000004307 00000 n 0000004434 00000 n 0000004508 00000 n 0000005473 00000 n trailer &lt;&lt; /Size 20 /Root 1 0 R /Info 5 0 R &gt;&gt; startxref 6553 %%EOF
  </code></pre>
  
  <p>I have my default.ctp in Layout/pdf/default.ctp and my view in my controller. Simply won´t create an pdf online. Any ideas?</p>