本文整理汇总了PHP中kartik\mpdf\Pdf类的典型用法代码示例。如果您正苦于以下问题:PHP Pdf类的具体用法?PHP Pdf怎么用?PHP Pdf使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pdf类的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: actionPdf
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();
}
示例13: 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();
}
示例14: actionView
/**
* 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();
}
示例15: dirname
<?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' => 'franruiz21@gmail.com', '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;