12

テーブル データといくつかのファンネル チャートで構成される php ページがあります。ページをヘッダーとフッター付きの pdf にエクスポートしたいと考えています。

javascript、jquery、またはその他の形式を使用してエクスポートする方法を教えてもらえますか?

ありがとうございました

4

1 に答える 1

11

FPDF を使用するには、リンクからダウンロードできます。詳細については、http://fpdf.org をご覧ください。

その後、次のように統合できます。

<?php

require_once('fpdf.php');

class PDF extends FPDF
{
    function Header()
    {
        $query='your query';
        $row=mysql_fetch_assoc($query); // data from database 


        $this->SetXY(50,60);
        $this->Cell(45,6,'Name  :',1,1,'R');
        $this->SetXY(95,60);
        $this->Cell(80,6,$row['pdf_name'],1,1);

        $this->SetXY(50,66);
        $this->Cell(45,6,'Email Address  :',1,1,'R');
        $this->SetXY(95,66);
        $this->Cell(80,6,$row['pdf_email'],1,1);

        $this->SetXY(50,72);
        $this->Cell(45,6,'Question Paper Selected  :',1,1,'R');
        $this->SetXY(95,72);
        $this->Cell(80,6,$row['subject_sel'],1,1);

        $this->SetXY(50,78);
        $this->Cell(45,6,'Total Correct Answers  :',1,1,'R');
        $this->SetXY(95,78);
        $this->Cell(80,6,$row['right_answered'],1,1);

        $this->SetXY(50,84);
        $this->Cell(45,6,'Percentage  :',1,1,'R');
        $this->SetXY(95,84);
        $this->Cell(80,6,$row['percentage']."%",1,1);

        $this->Ln(20);
    }
    function Footer()
    {
        $this->SetY(-15);
        $this->SetFont('Arial','I',8);
        $this->Cell(0,10,'abc according to you',0,0,'C');
    }
}
$pdf=new PDF('P','mm',array(297,210));
$pdf->Output($name.'.pdf','D');
?>

必要に応じて編集できます。レコードを表形式で表示し、pdf に生成します。それがあなたに役立つことを願っています。

アップデート:

画像用

$this->Image('image path',80,30,50);
于 2013-04-17T05:30:06.730 に答える