关于使用php和fpdf库创建pdf文件的页脚问题

时间:2013-01-05 06:41:15

标签: php pdf pdf-generation fpdf

  • 我已经使用fpdf在php中创建并成功创建了我的pdf文件 图书馆支持。

  • 但问题是我的页脚显示的空间更大。

  • 我想减少文字下方的空间。我的输出就像 这个: output

我的代码在这里:

<?php
    require('fpdf/fpdf.php'); 
    class PDF extends FPDF {


                function Header() {
                            $this->SetY(0.208333);
                        }
                function Footer() {
                                 if ($this->footer <> 1)
                                 {
                                $this->SetY(-15);
                             }
                             else
                             {
                                echo "bye";
                             }
                        }
    }

                        //class instantiation
                        $pdf=new PDF("l","in",array(8.5,4.17));
                            $pdf->SetFont('Arial','',8);
                            $pdf->footer = -15;
                            //Array2
                            $datas = array
                                    (
                                    'Address1' => array
                                    (
                                    'Name' => 'Vijaya',
                                    'Area' => 'Valasaravakkam',
                                    'City' => 'Chennai',
                                    ),
                                    'Address2' => array
                                    (
                                    'Companyname' => 'Vy Systems',
                                    'Area' => 'Valasaravakkam',
                                    'City' => 'Chennai',
                                    ),
                                    'Address3' => array
                                    (
                                    'Companyname' => 'Vy Systems1',
                                    'Area' => 'Valasaravakkam1',
                                    'City' => 'Chennai1',
                                    ),
                                    );
                            //Array2
                            $datas1 = array
                                    (
                                    'Address4' => array
                                    (
                                    'Name' => 'Jaya',
                                    'Area' => 'Valasaravakkam',
                                    'City' => 'Chennai',
                                    ),
                                    );

                            foreach($datas1 as $address1 => $details1)
                            {
                                //pdf_set_text_pos($pdf, 1240, 490);
                                //$pdf->ln(1);

                                    foreach($datas as $address => $details)
                                    {
                                        $pdf->SetMargins(0,0,0.3);
                                        $pdf->AddPage();
                                        if((is_array($details)) and (is_array($details1)))
                                        {
                                            foreach($details1 as $rows1 => $value1)
                                            {
                                                $pdf->SetX(0.520833);
                                                $pdf->MultiCell(0, 0.2, $value1, 0, "L");
                                            }
                                            $pdf->ln(1.96);
                                            foreach($details as $rows => $value)
                                            {
                                                $pdf->SetX(5);
                                                $pdf->MultiCell(5, 0.2, $value, 0, "L");
                                            }
                                        }

                                    }//end of sub foreach
                            }//end of main foreach

                        $pdf->Output();
?>

0 个答案:

没有答案