本文整理汇总了PHP中Pdf::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Pdf::render方法的具体用法?PHP Pdf::render怎么用?PHP Pdf::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pdf
的用法示例。
在下文中一共展示了Pdf::render方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionImprimir
public function actionImprimir()
{
// get your HTML raw content without any layouts or scrip
$pasostramite = pasostramite::find()->all();
$content = $this->renderPartial('_imprimir', ['pasostramite' => $pasostramite]);
$header = $this->renderPartial('_header', ['pasostramite' => $pasostramite]);
$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();
}
示例2: actionImprimirFiltro
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 = 'fecha_ft >= "' . $fechaInicial . '" and fecha_ft <= "' . $fechaFinal . '"';
$VisitasEscuelas = VisitasEscuelas::find()->where('fecha_ft >= :fechaInicial and fecha_ft <= :fechaFinal', ['fechaInicial' => $fechaInicial, 'fechaFinal' => $fechaFinal])->all();
$content = $this->renderPartial('_imprimir', ['VisitasEscuelas' => $VisitasEscuelas]);
$header = $this->renderPartial('_header', ['VisitasEscuelas' => $VisitasEscuelas]);
$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();
}
示例3: testEmbedHtmlImage
function testEmbedHtmlImage()
{
// NOTE: to embed images, use <img src=""> tag but specify a path to an existing file
$model = new \Core3\Model\Spreadsheet();
$model->defineColumns(array('id', 'name'));
$model->addRow(array('1', 'kalle'));
$model->addRow(array('2', 'olle'));
$imgFile = tempnam('/tmp', 'embedHtmlImage');
$this->createJpeg($imgFile);
$writer = new Pdf();
$writer->setStartHtmlBlock('<img src="' . $imgFile . '"/><br/>');
$writer->setEndHtmlBlock('<h2>GOODBYE</h2>');
$data = $writer->render($model);
unlink($imgFile);
$reader = new \Core3\Reader\BinaryData\Document();
$this->assertEquals(true, $reader->isRecognized($data));
$this->assertEquals(true, $reader->isPdfData($data));
}