public function actionItogovyj() { if (isset($_GET['vp']) and $vremya_provedeniya = $_GET['vp'] and isset($_GET['d']) and $dolzhnost = $_GET['d']) { $data = \Yii::$app->db->createCommand('select * from attestaciya_itogovij_otchet(:vp,:d) order by case when otraslevoe_soglashenie is null then 0 else 1 end desc, na_kategoriyu DESC, imeushayasya_kategoriya DESC, attestaciya_data_prisvoeniya DESC, fio')->bindValue(':vp', $vremya_provedeniya)->bindValue(':d', $dolzhnost)->queryAll(); $groups = ['otraslevoe_soglashenie' => []]; foreach ($data as $item) { if ($item['na_kategoriyu'] == KategoriyaPedRabotnika::VYSSHAYA_KATEGORIYA and $item['otraslevoe_soglashenie']) { $groups['otraslevoe_soglashenie'][] = $item; } else { $groups[$item['na_kategoriyu']][] = $item; } } $data = $groups; $content = $this->renderPartial('itogovyj-report', compact('data')); $indent = 3; $css = ' body{ font-family:"Times New Roman","serif"; } .paragraph{ text-align:justify; margin-bottom: 5px; margin-top: 5px; } .center{ text-align:center; } .tb {border-collapse: collapse} .tb td {padding: 5px;border: 1px solid #000} .inline-block{ display: inline-block; } .indent{padding-left: ' . $indent . 'em} .double-indent{padding-left: ' . 2 * $indent . 'em} .indent-block{ margin-left: ' . $indent . 'em; } .bold{ font-weight: bold; } '; $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_LANDSCAPE, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => $css, 'options' => ['title' => 'Отчет для к заседанию комиссии'], 'methods' => ['SetFooter' => ['']]]); // return the pdf output as per the destination setting return $pdf->render(); } else { $dolzhnosti = Dolzhnost::getDolzhnostiAttestacii(); return $this->render('itogovyj', compact('dolzhnosti')); } }
public function actionReport3() { $content = $this->renderPartial('_report'); // setup kartik\mpdf\Pdf component $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@backend/web/css/kv-mpdf-bootstrap.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => ['ทดลองการใช้ PDF ด้วย mpdf'], 'SetFooter' => ['{PAGENO}']]]); // return the pdf output as per the destination setting return $pdf->render(); //return $this->render('report3'); }
public function actionGenHandler() { $num = $_POST['num']; $type = $_POST['type']; $arr_no = []; for ($i = 0; $i < $num; $i++) { $no = Util::next($type); if ($no >= 10 && $no < 100) { $no = '0' . $no; } else { if ($no < 10) { $no = '00' . $no; } } $no = $type . $no; $arr_no[] = $no; $card = new Card(); $card->no = $no; $card->type = $type; $card->status = 'A'; $card->create_dt = date('Y-m-d'); $card->create_by = \Yii::$app->user->id; $card->save(); $this->genBarCode($no); } $ty = Ref::getDesc('ctype', $type); $content = $this->renderPartial('daily_card', ['arr_no' => $arr_no, 'type' => $ty]); $pdf = new Pdf(['content' => $content, 'orientation' => Pdf::ORIENT_PORTRAIT, 'cssFile' => 'css/card.css', 'marginLeft' => 5, 'marginRight' => 5]); $pdf->render(); }
public function attachFile() { try { $model = $this->owner; $fileName = Inflector::slug($model->fullAddress) . '.pdf'; $folder = $this->getModelSubDir() . '/'; $model->pdf_path = $fileName; $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'destination' => Pdf::DEST_FILE, 'content' => Yii::$app->view->render('@frontend/views/site/real-estate/print', ['model' => $model]), 'methods' => ['SetHeader' => ['Rapport ' . $model->fullAddress], 'SetFooter' => ['|Pagina {PAGENO}|']], 'filename' => Yii::getAlias('@uploadsBasePath') . "/files/{$folder}{$fileName}"]); $this->file = $pdf; BaseFileHelper::removeDirectory(Yii::getAlias('@uploadsBasePath') . "/files/{$folder}"); if (!BaseFileHelper::createDirectory(Yii::getAlias('@uploadsBasePath') . "/files/{$folder}")) { throw new Exception(Yii::t('app', 'Failed to create the file upload directory')); } // Save and update model $pdf->render(); $model->save(); return true; } catch (yii\base\Exception $e) { return $e->getMessage(); } }
public function actionPrintRaspisanie() { if (!isset($_GET['kurs'])) { throw new ErrorException('Kurs is required'); } $kurs_id = $_GET['kurs']; $schedule = []; $sql = 'select z.data, z.nomer, t.nazvanie as tema, z.forma, fl.familiya, fl.imya, fl.otchestvo, a.nazvanie as auditoriya, rpt.nazvanie as tip_rabot from zanyatie as z inner join zanyatie_chasti_temy as zct on z.id = zct.zanyatie inner join tema as t on zct.tema = t.id inner join podrazdel_kursa as pk on t.podrazdel = pk.id inner join razdel_kursa as rk on pk.razdel = rk.id inner join auditoriya as a on z.auditoriya = a.id inner join fiz_lico as fl on z.prepodavatel = fl.id inner join rabota_po_teme as rpt on t.tip_raboty = rpt.id where rk.kurs = :kurs_id order by z.data, z.nomer'; $data = Yii::$app->db->createCommand($sql)->bindValue(':kurs_id', $kurs_id)->queryAll(); foreach ($data as $item) { if (!isset($schedule[$item['data']])) { $schedule[$item['data']] = []; } $schedule[$item['data']][] = $item; } $kurs = \app\records\Kurs::findOne($kurs_id); $content = $this->renderPartial('/pdf/raspisanie.php', ['kurs' => $kurs, 'schedule' => $schedule]); $pdf = new Pdf($this->getPdfSeetings($content, 'Расписание курса "' . $kurs->nazvanie . '"')); // return the pdf output as per the destination setting return $pdf->render(); }
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(); } }
/** * @return mixed */ public function actionReport() { // get your HTML raw content without any layouts or scripts $content = $this->render('index'); // setup kartik\mpdf\Pdf component $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_LETTER, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => ['Krajee Report Header'], 'SetFooter' => ['{PAGENO}']]]); // return the pdf output as per the destination setting return $pdf->render(); }
public function actionImprimir() { // get your HTML raw content without any layouts or scrip $Proyectos = Proyectos::find()->all(); $content = $this->renderPartial('_imprimir', ['Proyectos' => $Proyectos]); $header = $this->renderPartial('_header', ['Proyectos' => $Proyectos]); $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => $header, 'SetFooter' => ['{PAGENO}']]]); // return the pdf output as per the destination setting return $pdf->render(); }
public function actionReport($id) { // get your HTML raw content without any layouts or scripts $model = Inventory::find()->where(['id' => $id])->one(); $content = $this->renderPartial('_reportView', ['model' => $model]); // setup kartik\mpdf\Pdf component $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => []]); // return the pdf output as per the destination setting return $pdf->render(); }
public function actionPrint($id) { $model = $this->findModel($id); $multimediaProvider = new ArrayDataProvider(['allModels' => Multimedia::findAll(['objetos_id' => $model->id])]); // $this->render('print', [ // 'model' => $model, // 'dataProvider' => $multimediaProvider, // ]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '* {font-size:14px}', 'content' => $this->renderPartial('print', ['model' => $model, 'dataProvider' => $multimediaProvider]), 'options' => ['title' => 'Acervo'], 'methods' => ['SetHeader' => ['Gestión de Colecciones'], 'SetFooter' => ['|Página {PAGENO}|']]]); return $pdf->render(); }
public function actionPrint($id) { $m = $this->findModel($id); $acervos = $this->getObjectsProvider($m); // return $this->render('print', [ // 'model' => $m, // 'acervos' => $acervos, // ]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '* {font-size:14px}', 'content' => $this->renderPartial('print', ['model' => $m, 'acervos' => $acervos]), 'options' => ['title' => 'Ingreso', 'subject' => 'Generating PDF files via yii2-mpdf extension has never been easy'], 'methods' => ['SetHeader' => ['Gestión de Colecciones -' . date("d-M-y")], 'SetFooter' => ['|Página {PAGENO}|']]]); return $pdf->render(); }
/** * Displays a single Landing model. */ public function actionView($landing_code) { //echo '<br><br><br><br><br>'.$example_code; if ($attr = Yii::$app->request->get('attr')) { if ($attr == 'pdf') { // get your HTML raw content without any layouts or scripts $content = $this->renderPartial('view', ['model' => $this->findModel($id)]); // setup kartik\mpdf\Pdf component $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_A4, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/bootstrap.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Сайт в pdf'], 'methods' => ['SetHeader' => ['Лендинг "Разработка сайтов"'], 'SetFooter' => ['{PAGENO}']]]); //die($pdf->cssFile); // return the pdf output as per the destination setting return $pdf->render(); } } return $this->render('view', ['model' => $this->findCodeModel($landing_code)]); }
public function actionPdf($id) { $model = $this->findModel($id); $content = $this->renderPartial('_cuenta_de_cobro', ['model' => $model]); $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_LETTER, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => 'css/cuenta.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Cuenta De Cobro'], 'methods' => ['SetHeader' => ['Elaborado desde areconsultoria.com.co || SIGER APP '], 'SetFooter' => ['{PAGENO}']], 'filename' => "CC " . strtoupper($model->idTercero->nombre) . " - " . $model->id_cuenta]); // return the pdf output as per the destination setting return $pdf->render(); }
public function actionIndex() { $content = $this->renderPartial('index'); // setup kartik\mpdf\Pdf component $pdf = new Pdf(['mode' => Pdf::MODE_UTF8, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'marginTop' => 10, 'marginLeft' => 15, 'marginRight' => 15, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.css', 'cssInline' => ' body{ font-family:"garuda", "sans-serif"; font-size:14px; } p{ font-size:10px; line-height: 4px; } #wrapper{ width: 210.5mm; height: 150mm; margin: 0px; } #header{ height: 25mm; } #header p{ margin-bottom: 0px; } .row1{ height: 50% margin: 0px; } .row2{ height: 50% margin: 0px; background-color: yellow; } ', 'options' => ['title' => ''], 'methods' => []]); // return the pdf output as per the destination setting return $pdf->render(); }
/** * Displays a single Przedmiot model. * @param integer $id * @param integer $kierunekStudiow_id * @param integer $user_id * @return mixed */ public function actionView($id, $kodKursu, $wymaganie, $nazwaPolska, $nazwaAngielska, $kierunekStudiow_id, $published, $user_id, $grupaKursow, $litPodstawowa, $litUzupelniajaca, $kierunekNazwa, $kierunekSpec, $kierunekStopien, $userName, $userSurname, $userEmail, $forma, $rodzaj) { $kursy = Kurs::find()->where(['przedmiot_id' => $id])->AsArray()->all(); $cele = CelKP::find()->where(['przedmiot_id' => $id])->AsArray()->all(); $peki = Pek::find()->where(['przedmiot_id' => $id])->AsArray()->all(); $tresci = TresciProgramowe::find()->where(['przedmiot_id' => $id])->AsArray()->all(); $narzedzia = NarzedziaDydaktyczne::find()->where(['przedmiot_id' => $id])->AsArray()->all(); $oceny = Ocena::find()->where(['przedmiot_id' => $id])->all(); $content = $this->renderPartial('viewPdf', ['id' => $id, 'kodKursu' => $kodKursu, 'wymaganie' => $wymaganie, 'nazwaPolska' => $nazwaPolska, 'nazwaAngielska' => $nazwaAngielska, 'kierunekStudiow_id' => $kierunekStudiow_id, 'published' => $published, 'user_id' => $user_id, 'grupaKursow' => $grupaKursow, 'litPodstawowa' => $litPodstawowa, 'litUzupelniajaca' => $litUzupelniajaca, 'kierunekNazwa' => $kierunekNazwa, 'kierunekSpec' => $kierunekSpec, 'kierunekStopien' => $kierunekStopien, 'kursy' => $kursy, 'cele' => $cele, 'peki' => $peki, 'tresci' => $tresci, 'narzedzia' => $narzedzia, 'userName' => $userName, 'userSurname' => $userSurname, 'userEmail' => $userEmail, 'oceny' => $oceny, 'forma' => $forma, 'rodzaj' => $rodzaj]); // setup kartik\mpdf\Pdf component $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => ['Krajee Report Header'], 'SetFooter' => ['{PAGENO}']]]); // return the pdf output as per the destination setting return $pdf->render(); }
<?php use kartik\mpdf\Pdf; $params = (require __DIR__ . '/params.php'); $config = ['id' => 'basic', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'components' => ['pdf' => ['class' => Pdf::classname(), 'format' => Pdf::FORMAT_A4, 'filename' => 'Contrato_empresa.pdf', 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'mode' => Pdf::MODE_CORE, 'options' => ['title' => 'Contratos Generados por Evnt Manager', 'subject' => 'Generating PDF files via yii2-mpdf extension has never been easy'], 'methods' => ['SetHeader' => ['El nombre de su empresa||Fecha de creación: ' . date("r")], 'SetFooter' => ['|Page {PAGENO}|']]], 'request' => ['cookieValidationKey' => 'LGXkWvibdS1IrlARgmP2YF1AJUKUdI6b'], 'cache' => ['class' => 'yii\\caching\\FileCache'], 'errorHandler' => ['errorAction' => 'site/error'], 'mailer' => ['class' => 'yii\\swiftmailer\\Mailer', 'viewPath' => '@app/mailer', 'useFileTransport' => false, 'transport' => ['class' => 'Swift_SmtpTransport', 'host' => 'smtp.gmail.com', 'username' => '*****@*****.**', 'password' => '266972319450', 'port' => '587', 'encryption' => 'tls']], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'db' => require __DIR__ . '/db.php'], 'modules' => ['user' => ['class' => 'dektrium\\user\\Module', 'enableUnconfirmedLogin' => true, 'confirmWithin' => 21600, 'cost' => 12, 'admins' => ['admin']]], 'params' => $params]; if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = ['class' => 'yii\\debug\\Module']; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = ['class' => 'yii\\gii\\Module']; } return $config;
public function actionPromissoria2($id, $idvenda) { //Criação de objetos para a geração do relatório $model = Cliente::findOne($id); $model2 = Venda::findOne($idvenda); //Adicionado Promissoria $searchModel2 = new VendaSearch(); $searchModel2->cliente_idcliente = $id; $dataProvider2 = $searchModel2->search(Yii::$app->request->queryParams); $content = $this->renderPartial('promissoria', ['model' => $model, 'model2' => $model2, 'dataProvider2' => $dataProvider2]); $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'SGO - Nota Promissória - Cliente'], 'methods' => ['SetHeader' => ['SGO - Nota Promissória - Cliente'], 'SetFooter' => ['{PAGENO}']]]); return $pdf->render(); }
public function actionImprimir($id) { $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'content' => $this->renderPartial('imprimir'), 'options' => ['title' => 'Recrutamento e Seleção - Senac AM'], 'methods' => ['SetHeader' => ['SOLICITAÇÃO DE CONTRATAÇÃO - SENAC AM||Gerado em: ' . date("d/m/Y - H:i:s")], 'SetFooter' => ['Recrutamento e Seleção - GRH||Página {PAGENO}']]]); return $pdf->render('imprimir', ['model' => $this->findModel($id)]); }
<?php use kartik\mpdf\Pdf; $params = array_merge(require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'); return ['id' => 'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\\controllers', 'bootstrap' => ['log'], 'modules' => [], 'homeUrl' => '/admin', 'components' => ['request' => ['baseUrl' => '/admin'], 'urlManager' => ['enablePrettyUrl' => false, 'showScriptName' => true], 'pdf' => ['class' => Pdf::classname(), 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER], 'user' => ['identityClass' => 'common\\models\\User', 'enableAutoLogin' => true], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'errorHandler' => ['errorAction' => 'site/error']], 'params' => $params];
public function actionPdf($id) { $r = $this->renderPartial('view', ['model' => $this->findModel($id), 'pdf' => true]); $pdf = new Pdf(['filename' => 'Detalle Acceso ' . $id . '.pdf', 'mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_DOWNLOAD, 'content' => $r, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => 'table.detail-view th {width: 25%;} table.detail-view td {width: 75%;}', 'options' => ['title' => 'Detalle de acceso'], 'methods' => ['SetHeader' => ['Detalle de Acceso - Miraflores'], 'SetFooter' => ['{PAGENO}']]]); return $pdf->render(); }
public function actionMpdfDemo2() { // $model = $this->findModel($id); // $model->load(Yii::$app->request->post()); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'content' => $html = ' <h3>Laporan Pemeriksaan Sarana Pengangkut</h3> <h2>Tables</h2> <h3>CSS Styles</h3> <p>The CSS properties for tables and cells is increased over that in html2fpdf. It includes recognition of THEAD, TFOOT and TH.<br />See below for other facilities such as autosizing, and rotation.</p> <table border="1"> <tbody><tr><td>Row 1</td><td>This is data</td><td>This is data</td></tr> <tr><td>Row 2</td> <td style="background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5;"> <p>This is data p</p> This is data out of p <p style="font-weight:bold; font-size:20pt; background-color:#FFBBFF;">This is bold data p</p> <b>This is bold data out of p</b><br /> This is normal data after br <h3>H3 in a table</h3> <div>This is data div</div> This is data out of div <div style="font-weight:bold;">This is data div (bold)</div> This is data out of div </td> <td><p>More data</p><p style="font-size:12pt;">This is large text</p></td></tr> <tr><td><p>Row 3</p></td><td><p>This is long data</p></td><td>This is data</td></tr> <tr><td><p>Row 4 <td> cell</p></td><td>This is data</td><td><p>This is data</p></td></tr> <tr><td>Row 5</td><td>Also data</td><td>Also data</td></tr> <tr><td>Row 6</td><td>Also data</td><td>Also data</td></tr> <tr><td>Row 7</td><td>Also data</td><td>Also data</td></tr> <tr><td>Row 8</td><td>Also data</td><td>Also data</td></tr> </tbody></table> ', 'options' => ['title' => 'Diklat PIM 186', 'subject' => 'Generating PDF files via yii2-mpdf extension has never been easy'], 'methods' => ['SetHeader' => ['Generated By: Anhar Deni ' . date("r")], 'SetFooter' => ['Generated By: Anhar Deni ' . date("r"), '|Page {PAGENO}|']]]); return $pdf->render(); }
/** * Cetak PDF Approvad * @param string $id * @return mixed * @author ptrnov <*****@*****.**> * @since 1.1 */ public function actionCetakpdf($kd, $v) { $dinasHeader = Salesorder::find()->where(['KD_SA' => $kd])->one(); /*Noted check by status approval =1 header table | chek error record jika kosong*/ $detdinas = $dinasHeader->detdinas; $employ = $dinasHeader->employe; $dept = $dinasHeader->dept; if ($v == 101) { $filterPdf = "KD_SA='" . $kd . "' AND (STATUS='101' OR STATUS='10')"; } elseif ($v != 101) { $filterPdf = "KD_SA='" . $kd . "' AND STATUS<>'3'"; } $Detaildinas = Sadetail::find()->where($filterPdf)->all(); /* PR Filter Status Output to Grid print*/ $dataProvider = new ArrayDataProvider(['key' => 'ID', 'allModels' => $Detaildinas, 'pagination' => ['pageSize' => 20]]); //PR //$dataProviderFilter = $dataProvider->getModels(); /* $StatusFilter = ["101","10"]; $test1 = ArrayHelper::where($dataProviderFilter, function($key, $StatusFilter) { return is_string($value); }); print_r($test1); */ $content = $this->renderPartial('pdfview', ['dinasHeader' => $dinasHeader, 'detdinas' => $detdinas, 'employ' => $employ, 'dept' => $dept, 'dataProvider' => $dataProvider]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@lukisongroup/web/widget/pdf-asset/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:12px}', 'options' => ['title' => 'Form Request Order', 'subject' => 'ro'], 'methods' => ['SetHeader' => ['Copyright@LukisonGroup ' . date("r")], 'SetFooter' => ['{PAGENO}']]]); return $pdf->render(); }
<?php use kartik\mpdf\Pdf; $params = (require __DIR__ . '/params.php'); $config = ['id' => 'basic', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'modules' => ['gridview' => ['class' => '\\kartik\\grid\\Module'], 'rbac' => ['class' => 'dektrium\\rbac\\Module', 'admins' => ['admin', 'Superadmin']]], 'components' => ['pdf' => ['class' => Pdf::classname(), 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER], 'assetManager' => ['bundles' => ['dmstr\\web\\AdminLteAsset' => ['skin' => 'skin-blue']]], 'request' => ['cookieValidationKey' => 'gymgecko-admn'], 'cache' => ['class' => 'yii\\caching\\FileCache'], 'user' => ['identityClass' => 'app\\models\\User', 'enableAutoLogin' => true], 'errorHandler' => ['errorAction' => 'site/error'], 'urlManager' => ['enablePrettyUrl' => true, 'showScriptName' => false], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'db' => require __DIR__ . '/db.php'], 'params' => $params]; if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = ['class' => 'yii\\debug\\Module']; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = ['class' => 'yii\\gii\\Module']; } return $config;
public function actionCetakpdf($id) { # code... $data = Termcustomers::find()->where(['ID_TERM' => $id])->one(); $datainternal = Jobgrade::find()->where(['JOBGRADE_ID' => $data['JOBGRADE_ID']])->asArray()->one(); $datacus = Customers::find()->where(['CUST_KD' => $data->CUST_KD])->asArray()->one(); // $term = Termgeneral::find()->where(['ID'=>$data['GENERAL_TERM']])->asArray() // ->one(); $datadis = Distributor::find()->where(['KD_DISTRIBUTOR' => $data->DIST_KD])->asArray()->one(); $datacorp = Corp::find()->where(['CORP_ID' => $data->PRINCIPAL_KD])->asArray()->one(); $sql = "SELECT c.INVES_TYPE,c.ID_TERM,c.BUDGET_PLAN,c.BUDGET_ACTUAL,c.PERIODE_START,c.PERIODE_END,b.TARGET_VALUE from c0005 c LEFT JOIN c0003 b on c.ID_TERM = b.ID_TERM where c.ID_TERM='" . $id . "'"; $data1 = Termbudget::findBySql($sql)->all(); $sqlsum = "SELECT SUM(BUDGET_PLAN) as BUDGET_PLAN,SUM(BUDGET_ACTUAL) as BUDGET_ACTUAL from c0005 where ID_TERM='" . $id . "'"; $datasum = Termbudget::findBySql($sqlsum)->one(); $dataProvider = new ArrayDataProvider(['key' => 'ID_TERM', 'allModels' => $data1, 'pagination' => ['pageSize' => 20]]); $content = $this->renderPartial('_pdf', ['data' => $data, 'datainternal' => $datainternal, 'datacus' => $datacus, 'datadis' => $datadis, 'datacorp' => $datacorp, 'datasum' => $datasum, 'dataProvider' => $dataProvider]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@lukisongroup/web/widget/pdf-asset/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:12px}', 'options' => ['title' => 'Term-Customers', 'subject' => 'Term'], 'methods' => ['SetHeader' => ['Copyright@LukisonGroup ' . date("r")], 'SetFooter' => ['{PAGENO}']]]); return $pdf->render(); }
public function actionImprimirFiltro() { //echo'<pre>';print_r($_GET);echo'</pre>'; exit; $fechaInicial = date("d-m-Y", strtotime($_GET['fechas']["filtro"]["fechaInicial"])); $fechaFinal = date("d-m-Y", strtotime($_GET['fechas']["filtro"]["fechaFinal"])); $formato = 'fechaCreacion >= "' . $fechaInicial . '" and fechaCreacion <= "' . $fechaFinal . '"'; $Dictamenes = Dictamenes::find()->where('fechaCreacion >= :fechaInicial and fechaCreacion <= :fechaFinal', ['fechaInicial' => $fechaInicial, 'fechaFinal' => $fechaFinal])->all(); $content = $this->renderPartial('_imprimir', ['Dictamenes' => $Dictamenes]); $header = $this->renderPartial('_header', ['Dictamenes' => $Dictamenes]); $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => $header, 'SetFooter' => ['{PAGENO}']]]); // return the pdf output as per the destination setting return $pdf->render(); }
/** *Создаем отчет PDF */ public static function Pdf($id, $save = null) { $date = date("dmY"); $pdf = new Pdf(['orientation' => Pdf::ORIENT_LANDSCAPE, 'destination' => $save ? Pdf::DEST_FILE : Pdf::DEST_BROWSER, 'cssInline' => ' body{background-color: #3366CC;} ', 'filename' => 'Report' . $id . '-' . $date . '.pdf', 'marginRight' => '5', 'marginLeft' => '5', 'marginTop' => '5', 'marginBottom' => '20', 'options' => ['title' => 'SojuzPharma']]); // or new Pdf(); $mpdf = $pdf->api; // fetches mpdf api $html = self::generateTablePdf($id); $mpdf->shrink_tables_to_fit = 8; $mpdf->use_kwt = true; $mpdf->table_keep_together = true; $mpdf->WriteHtml($html); // call mpdf write html $filename = \Yii::$app->basePath . '/temp/validation/' . $id . '.pdf'; $mpdf->Output($filename, 'F'); // call the mpdf api output as needed $pdf->render(); return $filename; }
<?php Yii::setAlias('@themes', dirname(__DIR__) . '/themes'); $params = (require __DIR__ . '/params.php'); use kartik\mpdf\Pdf; $config = ['id' => 'basic', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'language' => 'th', 'modules' => ['gridview' => ['class' => '\\kartik\\grid\\Module'], 'user' => ['class' => 'dektrium\\user\\Module']], 'components' => ['pdf' => ['class' => Pdf::classname(), 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER], 'cart' => ['class' => 'yz\\shoppingcart\\ShoppingCart', 'cartId' => 'my_application_cart'], 'thaiFormatter' => ['class' => 'dixonsatit\\thaiYearFormatter\\ThaiYearFormatter'], 'request' => ['cookieValidationKey' => 'cptAfR4ZoNM81Y54zFCnlJ_CzyrgT4BI'], 'cache' => ['class' => 'yii\\caching\\FileCache'], 'errorHandler' => ['errorAction' => 'site/error'], 'mailer' => ['class' => 'yii\\swiftmailer\\Mailer', 'useFileTransport' => true], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'db' => require __DIR__ . '/db.php'], 'params' => $params]; if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = 'yii\\debug\\Module'; $config['bootstrap'][] = 'gii'; // $config['modules']['gii'] = 'yii\gii\Module'; //$config['modules']['gii'] = ['class' => 'yii\gii\Module', 'allowedIPs' => ['1.179.182.82']]; $config['modules']['gii'] = ['class' => 'yii\\gii\\Module', 'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '1.179.182.82']]; } return $config; return array_merge_recursive($config, require $_SERVER['DOCUMENT_ROOT'] . '/vendor/noumo/easyii/config/easyii.php');
public function actionTempCetakpdf($kdpo) { $poHeader = Purchaseorder::find()->where(['KD_PO' => $kdpo])->one(); //$poDetail = Purchasedetail::find()->where(['KD_PO'=>$kdpo])->all(); $poDetailQry = "SELECT ID,KD_PO,KD_RO,KD_BARANG,NM_BARANG,UNIT,NM_UNIT,UNIT_QTY,UNIT_WIGHT,SUM(QTY) AS QTY,HARGA,STATUS,STATUS_DATE,NOTE\n\t\t\t\t\t\tFROM `p0002` WHERE KD_PO='" . $kdpo . "' GROUP BY KD_BARANG,NM_UNIT,HARGA"; $poDetail = Purchasedetail::findBySql($poDetailQry)->all(); $dataProvider = new ArrayDataProvider(['key' => 'KD_PO', 'allModels' => $poDetail, 'pagination' => ['pageSize' => 20]]); $content = $this->renderPartial('pdf_tmp', ['poHeader' => $poHeader, 'dataProvider' => $dataProvider]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@lukisongroup/web/widget/pdf-asset/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:12px}', 'options' => ['title' => 'Form Request Order', 'subject' => 'ro'], 'methods' => ['SetHeader' => ['Copyright@LukisonGroup ' . date("r")], 'SetFooter' => ['{PAGENO}']]]); return $pdf->render(); /* $mpdf=new mPDF(); $mpdf->WriteHTML($this->renderPartial( 'pdf', [ 'model' => Purchaseorder::find()->where(['KD_PO'=>$kdpo])->one(), ])); $mpdf->Output(); exit; */ }
public function actionPrint() { $searchModel = new UserSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $this->render('usuarios', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '* {font-size:14px}', 'content' => $this->renderPartial('usuarios', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]), 'options' => ['title' => 'Listado de Usuarios', 'subject' => 'Generating PDF files via yii2-mpdf extension has never been easy'], 'methods' => ['SetHeader' => ['Generado el: ' . date("d-M-y")], 'SetFooter' => ['|Page {PAGENO}|']]]); return $pdf->render(); }
/** * Generates the PDF file * * @param string $content the file content * @param string $filename the file name * @param array $config the configuration for yii2-mpdf component * * @return void */ protected function generatePDF($content, $filename, $config = []) { unset($config['contentBefore'], $config['contentAfter']); $config['filename'] = $filename; $config['methods']['SetAuthor'] = ['Krajee Solutions']; $config['methods']['SetCreator'] = ['Krajee Yii2 Grid Export Extension']; $config['content'] = $content; $pdf = new Pdf($config); echo $pdf->render(); }