\backend\models\core\Pdf

对Pdf的操作

使用方法如下:

$content 是html的文件内容部分  $pdf->render()方法后,就显示下载了。

//echo $content;exit;
		$lib_google_base = Yii::getAlias("@common/lib/mpdf");
		require_once $lib_google_base.'/mpdf.php';
		$pdf = new Pdf([
			'format' => Pdf::FORMAT_A4, 
			'mode' => Pdf::MODE_ASIAN, // leaner size using standard fonts
			'content' => $content,
			//'options' => [
				//'title' => 'Privacy Policy - Krajee.com',
				//'subject' => 'Generating PDF files via yii2-mpdf extension has never been easy'
			//],
			'methods' => [
				//'SetHeader' => ['Generated By: Krajee Pdf Component||Generated On: ' . date("r")],
				//'SetFooter' => ['|Page {PAGENO}|'],
			]
		]);
		echo $pdf->render();
		exit;


你可能感兴趣的:(\backend\models\core\Pdf)