【问题标题】:How can i increment the of receipt number in pdf after printout of each pdf page using php?使用php打印输出每个pdf页面后,如何增加pdf中的收据编号?
【发布时间】:2015-03-16 04:45:49
【问题描述】:

我需要在每个 pdf 打印输出后通过递增来显示收据编号,我正在使用 fpdf 创建收据,我想计算第一页的收据编号,第二页 2 等等。

我可以为此使用会话吗?

感谢任何帮助。

这是我的 pdf 代码:

<?php
    if(!empty($_POST['register']))
    {
        $calender=$_POST['datum1'];
        $time=$_POST['timepicker_6'];
        $respected=$_POST['first_name'];
        $month=$_POST['second_name'];
        $year=$_POST['third_name'];
        $fees=$_POST['fourth_name'];
        $amount=$_POST['fifth_name'];
    require("fpdf/fpdf.php");

    $pdf=new FPDF();
    $pdf->Addpage();
    // Logo
    $pdf->Image('33990.jpg',10,2,30);
    $pdf->SetFont("Arial","B",20);
    $pdf->cell(0,10,"Madirasheri Mahal Jamath ",0,1,'C');
    $pdf->SetFont("Arial","B",18);
    $pdf->cell(0,10,"P.O Thrikanapuram-679573,register number:529/98 ",0,1,'C');

    $pdf->SetFont("Arial","B",18);
    $pdf->Cell(0,10,"Receipt number:",0,0,'C');

    $pdf->SetFont("Arial","B",18);
    $pdf->cell(0,10,"Date:{$calender} ",0,1,'R');  


    $pdf->cell(0,10,"Time:{$time}",0,1,'R');


    $pdf->cell(0,30,"We have received sum of Rs  {$fees},for the month of ",0,1);

    $pdf->cell(0,-15,"{$month},{$year} From Mr/Mrs {$respected}.",0,1);

    $pdf->cell(0,60,"Amount :{$amount} ",0,1);
    $pdf->cell(0,20,"Secretory: ........... ",0,1,'R');

    $pdf->output();
    }
?>

我正在使用 fpdf:http://www.fpdf.org

【问题讨论】:

    标签: php pdf fpdf


    【解决方案1】:

    FPDF 带有一个名为 PageNo 的内置函数,它应该可以满足您的需要。

    $pdf->Cell(0,10,"Receipt number: ".$pdf->PageNo(),0,0,'C');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-23
      • 2016-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-17
      相关资源
      最近更新 更多