1
我正在使用jQuery將數據發佈到Yii控制器操作,它將呈現PDF。但是面臨一些問題。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 trailer < < /尺寸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');
}
有出亂子用我的代碼?
你沒有嘗試你的代碼沒有ajax ..這是否工作? –
我嘗試過使用GET(使用url http://localhost/app/index.php/print/recufrais/NomFichier/test.pdf),並且一切都很順利。 – sk001