如何在PHP中打印创建的PDF文件?

时间:2012-03-30 20:18:47

标签: php codeigniter pdf printing

好的我正在使用FPDF库生成pdf文件

    $this->load->library('fpdf');


    $pdf = new FPDF();
    $pdf->addPage();
    $pdf->SetFont('Arial','B',16);
    $pdf->Cell(200,10,'Coupon Information',0,0, 'C');
    $pdf->Ln(10);
    $pdf->SetFont('Arial','',16);
    $pdf->Cell(40,10,'user id: '.$user_id);
    $pdf->Ln(10);
    $pdf->Cell(40,10,'coupon name: '.$name);
    $pdf->Ln(10);
    $pdf->Cell(40,10,'coupon price: '.$price);
    $pdf->Ln(10);
    $pdf->Cell(40,10,'discount: '.$discount);
    $pdf->Ln(10);
    $pdf->Cell(40,10,'coupon number: '.$gen_id);
    $pdf->Output();

如何在php中打印PDF文件而不是输出?或者是否有codeigniter的解决方案?

1 个答案:

答案 0 :(得分:2)

打印PDF是一种客户端操作,您无法强制从代码中打印。想象一下,你访问一个网站,你的打印机扔纸。那会......很奇怪!

相关问题