2016-09-30 8 views
1

私は、pdfをレンダリングするYiiコントローラのアクションにデータを投稿するためにjQueryを使用しています。しかし、いくつかの問題に直面。FPDF、Yii、jQueryが機能しない

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 <> ストリーム xeMN0 = b<Ώ dZ @ BlXq- S$ "y ͛7 予告編 < < /サイズ9 /ルート8 0 R /情報7 0 R > startxref の%% 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'); 
} 

あります私のコードで?

+0

あなたはajaxなしであなたのコードを試しましたか?これは動作しているかどうか? –

+0

私はGET(URL:http://localhost/app/index.php/print/recufrais/NomFichier/test.pdf)を試してみましたが、すべてうまくいっています。 – sk001

答えて

0

Oh no。依存関係がありません: require_once 'tools/php/functions.php'; $NomFichier = "etats/recufrais/" .$_POST['NomFichier'];

inside my controller action。ご注意いただきありがとうございます。

関連する問題