FPDF生成的空白页面

时间:2016-03-10 22:46:31

标签: php pdf syntax-error fpdf

你好,我得到一个空白页面。请帮助我,我用Google搜索大约2个小时,但发现没有任何对我有用....我试图在浏览器中显示生成的PDF,但它不起作用。我只是空白页。

<?phprequire("fpdf/fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();

$pdf->SetFont("Helvetica", "B", 26);
$pdf->SetLineWidth(0.4);
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetTextColor(0, 0, 0);              // Header
$pdf->SetY(+10);

$pdf->Cell(0, 10,$_POST["input"],"", 0, "C", 36);
$pdf->Ln();

$pdf->SetFont("Helvetica", "", 11);
$pdf->SetLineWidth(0.4);
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetFillColor(255, 255, 255);                      // Adresse
$pdf->SetTextColor(0, 0, 0);
$pdf->SetY(+20);

$pdf->Cell(0, 10,$_POST["input2"],"", 0, "C", 11);
$pdf->Ln();

$pdf->SetFont("Helvetica","", 11);
$pdf->SetLineWidth(0.4);
$pdf->SetDrawColor(0, 0, 0);                                // E-Mail
$pdf->SetFillColor(255, 255, 255);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetY(+30);

$pdf->Cell(0, 10,$_POST["input7"],"B", 0, "C", 11);

/* Einstellung für Überschrift */
$pdf->SetFont("Helvetica", "B", 11);
$pdf->SetLineWidth(0.4);
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetFillColor(192, 192, 192);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetY(+120);

/* Überschrift */

$pdf->Cell(30, 10, "Menge", "LTRB", 0, "C", 1);
$pdf->Cell(130, 10, $_POST["date"], "LTRB", 0, "C", 1);
$pdf->Cell(30, 10, "Kosten", "LTRB", 0, "C", 1);
$pdf->Ln();

$pdf->SetFillColor(255,255,255);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont("Helvetica", "B", 11);
$pdf->SetLineWidth(0.4);
$pdf->Cell(30, 10, $_POST["input4"], "LTRB", 0, "C", 1);
$pdf->Cell(130, 10, $_POST["input5"], "LTRB", 0, "C", 1);
$pdf->Cell(30, 10, chr(128)." ".$_POST["input6"], "LTRB", 0, "C", 1);

$pdf->Ln();
$pdf->Ln();
$pdf->SetFont("Helvetica", "", 11);
$pdf->SetLineWidth(0.4);
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetFillColor(255, 255, 255);                      // Adresse
$pdf->SetTextColor(0, 0, 0);
$pdf->SetY(+190);

$pdf->Cell(0, 10, "Preise inkl. 20% MWSt","", 0, "C", 11);

$pdf->Ln();
$pdf->SetFont("Helvetica", "", 11);
$pdf->SetLineWidth(0.4);
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetFillColor(255, 255, 255);                      // Adresse
$pdf->SetTextColor(0, 0, 0);
$pdf->SetY(+200);

$pdf->Cell(0, 10, "Das Lieferdatum entspricht dem Rechnungsdatum","", 0, "C", 11);

$pdf->Ln();
$pdf->SetFont("Helvetica", "", 11);
$pdf->SetLineWidth(0.4);
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetFillColor(255, 255, 255);                      // Adresse
$pdf->SetTextColor(0, 0, 0);
$pdf->SetY(+250);

$pdf->Cell(0, 10, "www.hakki-uzel.at","", 0, "C", 11);

$pdf->Output();
?>

1 个答案:

答案 0 :(得分:0)

确保您的输出符合规则/格式

$pdf->Output('your file name', 'I');

请阅读输出功能表http://www.fpdf.org/en/doc/output.htm

的手册