FPDF、Yii 和 jQuery 不工作

FPDF, Yii and jQuery not working

我正在使用 jQuery 到 post 数据到将呈现 pdf 的 Yii 控制器操作。但面临一些问题。

nom = "toto";
$.post(baseUrl+'print/recufrais',{"NomFichier" : nom+'.pdf', "id": code},
    function(responde)
    {
        console.log(responde);
    }
);

日志是:

%PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream x�e�MN�0��=���b<Ώ���dZ�� �@BlXq-��-�S$�"y��͛7 trailer << /Size 9 /Root 8 0 R /Info 7 0 R > startxref 987 %%EOF

动作如下:

public function actionRecufrais()
{
    //header('Content-type: application/pdf');
    $NomFichier = $_POST['NomFichier'];
    $PDF=New phpToPDF();
    $PDF->FPDF('P');
    $PDF->AddPage();

    $PDF->SetFont('Courier','B','15');//$PDF->SetXY(60, 47);
    $PDF->Ln(); 

    $PDF->MultiCell(0, 15, iconv("UTF-8", "windows-1252", "RECU DE REGLEMENT"), 0, "C", 0);

    $PDF->SetFont('Courier', 'B', '11');
    $PDF->MultiCell(0, 15, iconv("UTF-8", "windows-1252", "NOM ET PRENOMS DE L'ELEVE : "), 0, 'L', 0);


    $PDF->Output($NomFichier, 'F');
    $PDF->Output($NomFichier, 'D');
}

我的代码有问题吗?

哦不。缺少依赖项: require_once 'tools/php/functions.php'; $NomFichier = "etats/recufrais/" .$_POST['NomFichier'];

在我的控制器动作中。感谢您的关注。