本文整理汇总了PHP中kartik\mpdf\Pdf::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Pdf::render方法的具体用法?PHP Pdf::render怎么用?PHP Pdf::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\mpdf\Pdf
的用法示例。
在下文中一共展示了Pdf::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionItogovyj
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'));
}
}
示例2: actionReport3
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');
}
示例3: actionGenHandler
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();
}
示例4: attachFile
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();
}
}
示例5: actionExportar
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();
}
}
示例6: actionReport
/**
* @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();
}
示例7: actionImprimir
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();
}
示例8: actionReport
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();
}
示例9: actionPrint
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();
}
示例10: actionPrint
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();
}
示例11: actionView
/**
* 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)]);
}
示例12: actionIndex
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();
}
示例13: actionPrintDostizheniya
public function actionPrintDostizheniya($id = false)
{
if (!$id) {
throw new Exception('id parameter is required');
}
$zayavlenie = ZayavlenieNaAttestaciyu::find()->joinWith('fizLicoRel')->where(['zayavlenie_na_attestaciyu.id' => $id])->one();
$content = $this->renderPartial('_printDostizheniya', compact('zayavlenie'));
$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_PORTRAIT, '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();
}
示例14: actionPromissoria2
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();
}
示例15: actionImprimir
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)]);
}