title: Generate pdf in yii2 console
body: <p>I want to generate pdf in yii2 console but getting error. The code execute correctly in <code>web</code> but not in <code>console</code>. I am using <code>mdf</code> extension for it.</p>
  
  <pre><code>public function actionInvoicePdf($invoice) {
       $content = $this-&gt;renderPartial('_invoicePdf',['invoice'=&gt;$invoice]);
       Yii::$app-&gt;response-&gt;format = \yii\web\Response::FORMAT_RAW;
       $headers = Yii::$app-&gt;response-&gt;headers;
       $headers-&gt;add('Content-Type', 'application/pdf');
       $path = Yii::getAlias('@uploadPath').'/pdf/commission-invoice/';
      // setup kartik\mpdf\Pdf component
      $pdf = new Pdf([
          'mode' =&gt; Pdf::MODE_CORE, 
          'format' =&gt; Pdf::FORMAT_A4, 
          'filename' =&gt; 'test.pdf', //$path.$invoice-&gt;invoice_filename,
          'orientation' =&gt; Pdf::ORIENT_PORTRAIT, 
          'destination' =&gt; Pdf::DEST_FILE, //Pdf::DEST_FILE
          'content' =&gt; $content,  
          'cssInline' =&gt; '.kv-heading-1{font-size:18px}', 
           // set mPDF properties on the fly
          'options' =&gt; ['title' =&gt; 'Invoice #'],
           // call mPDF methods on the fly
          'methods' =&gt; [ 
              'SetHeader'=&gt;['Invoice:buyold'], 
              'SetFooter'=&gt;['{PAGENO}'],
          ]
      ]);
      return $pdf-&gt;render(); 
  }
  </code></pre>
  
  <p>Getting error Exception </p>
  
  <pre><code>'yii\base\UnknownPropertyException' with message 'Setting unknown prop
  erty: yii\console\Response::format'
  
  Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown prop
  erty: yii\console\Response::headers'
  </code></pre>
  
  <p>Here is my console config file</p>
  
  <pre><code>return [
  'id' =&gt; 'app-console',
  'basePath' =&gt; dirname(__DIR__),
  'bootstrap' =&gt; ['log'],
  'controllerNamespace' =&gt; 'console\controllers',
  'components' =&gt; [
      'log' =&gt; [
          'targets' =&gt; [
              [
                  'class' =&gt; 'yii\log\FileTarget',
                  'levels' =&gt; ['error', 'warning'],
              ],
          ],
      ],
      'session' =&gt; [ // for use session in console application
          'class' =&gt; 'yii\web\Session'
      ],
  ],
  
  'params' =&gt; $params,
  </code></pre>
  
  <p>];</p>