簡體   English   中英

在使用php打印每個pdf頁面后,如何增加pdf中的收據編號?

[英]How can i increment the of receipt number in pdf after printout of each pdf page using php?

我需要在打印每個pdf后通過遞增顯示收據編號,我正在使用fpdf創建收據,我想計算第一頁第一頁,第二頁第二頁的收據編號,依此類推。

我可以為此使用會話嗎?

任何幫助表示贊賞。

這是我的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

FPDF帶有一個稱為PageNo的內置函數,該函數PageNo您的需要。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM