これは私がpdfとしてダウンロードしたい私のビューページです。マイビュー・リンク:私は、そのページの右上部にあるダウンロードPDFボタンを配置することで、私をクリックするとhttp://localhost/myproject/Applicant/1yiiビューページをpdfに変換してダウンロードするには?
、ユーザープロファイルがPDFでダウンロードする必要があります。私はyiiの新しいので、それを行う方法がわからないが、Googleで検索すると、私はいくつかの拡張子を発見した。これら上記の拡張機能に従うことによって
- のYii-PDF
- mpdf1
、私は私のprotected/extension
フォルダにこれらの拡張子を置きます。そして、ここに私のメイン/ configファイルが...
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'class' => 'WebUser',
'allowAutoLogin'=>true,
'returnUrl'=>'/site/index#login',
'loginUrl'=>array('/Applicant/login'),
),
'ePdf' => array(
'class' => 'ext.yii-pdf.EYiiPdf',
'params' => array(
'mpdf' => array(
'librarySourcePath' => 'application.extensions.mpdf.*',
'constants' => array(
'_MPDF_TEMP_PATH' => Yii::getPathOfAlias('application.runtime'),
),
'class'=>'mpdf', // the literal class filename to be loaded from the vendors folder
/*'defaultParams' => array(// More info: http://mpdf1.com/manual/index.php?tid=184
'mode' => '', // This parameter specifies the mode of the new document.
'format' => 'A4', // format A4, A5, ...
'default_font_size' => 0, // Sets the default document font size in points (pt)
'default_font' => '', // Sets the default font-family for the new document.
'mgl' => 15, // margin_left. Sets the page margins for the new document.
'mgr' => 15, // margin_right
'mgt' => 16, // margin_top
'mgb' => 16, // margin_bottom
'mgh' => 9, // margin_header
'mgf' => 9, // margin_footer
'orientation' => 'P', // landscape or portrait orientation
)*/
),
),
),
である私は私が次に何をすべきApplicantController
public function actionPDF()
{
$mPDF1 = Yii::app()->ePdf->mpdf();
$mPDF1->WriteHTML($this->render('UserProfileView',true));
$mPDF1->Output();
}
にこのアクションを作成していますか?どのようにファイルをダウンロードするコントローラアクションにリンクしているそのビューファイルのボタンを取得する。
あなたは何を正確に意味するのかわかりません。私はフォームを持っていません。ユーザーのデータベーステーブルから情報を取得し、テーブルのビューページに表示しています。 –