public function actionExportar()
 {
     // get your HTML raw content without any layouts or scripts
     if (isset($_COOKIE['pcbuilder_cart'])) {
         $total = 0;
         $pcbuilder_cart = unserialize($_COOKIE['pcbuilder_cart']);
         if (count($pcbuilder_cart) > 0) {
             $pcbuilder_cart = Yii::$app->PCBuilder->array_sort($pcbuilder_cart, 'categoria', 'SORT_ASC');
             foreach ($pcbuilder_cart as $i => $peca) {
                 $modelPeca = Pecas::findOne($peca['peca']);
                 $pecas[] = ['id' => $modelPeca['id'], 'cookieID' => $i, 'nome' => $modelPeca['nome'], 'loja' => $modelPeca['loja'], 'link_externo' => $modelPeca['link_externo'], 'preco' => $modelPeca['preco'][0]['preco']];
                 $total = $total + $modelPeca['preco'][0]['preco'];
             }
         }
     } else {
         echo "Nada para salvar!";
         exit;
     }
     if (count($pecas) > 0) {
         $content = $this->renderPartial('_pdf', ['pecas' => $pecas, 'total' => $total]);
         $date = new \Datetime(null);
         $hoje = $date->getTimestamp() + $date->getOffset();
         // setup kartik\mpdf\Pdf component
         $pdf = new Pdf(['mode' => Pdf::MODE_BLANK, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_DOWNLOAD, 'content' => $content, 'filename' => 'PC Builder - Lista de Peças - ' . date("d.m.Y H.i.s", $hoje) . '.pdf', 'options' => ['title' => 'PC Builder - Lista de Peças - ' . date("d/m/Y H:i:s", $hoje), 'defaultheaderline' => 0, 'setAutoTopMargin' => 'stretch'], 'methods' => ['SetHeader' => ['' . '<table width="100%">' . '<tr>' . '<td width="75%"><a target="_blank" href="http://www.brunodeoliveira.com"><img width="100px" src="imgs/logo.png"></a></td>' . '<td width="25%" valign="bottom" style="text-align: right">Salvo em<br /><small>' . date("d/m/Y H:i:s") . '</small></td>' . '<tr/>' . '</table>' . ''], 'SetFooter' => ['Obrigado por utilizar o PC Builder - Desenvolvido por Bruno de Oliveira - Página {PAGENO}']]]);
         return $pdf->render();
     }
 }