$date = date("m/d/Y h:i A");
$pdf->date = $date;
$header1 = array('Usage Order #', 'Used By', 'For Tool', 'Date', 'Notes', 'Status');
$header = array('Component Used', 'Quantity Used', 'Cost', 'Status', 'Date Used', 'Subtotal');
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetY(35);
$pdf->BuildTable1($header1, $data1);
$pdf->SetY(55);
$pdf->BuildTable($header, $data);
$pdf->Ln(6);
$substring = " Total Subtotal: \$" . $subtotal . " ";
$substrwidth = $pdf->GetStringWidth($substring);
$substrX = 260 - $substrwidth;
$pdf->SetX($substrX);
$pdf->Cell($substrwidth, 6, $substring, 1, 1, 'C');
$tax = $subtotal * 0.075;
$tax = round($tax, 2);
$tax = number_format((double) $tax, 2, '.', '');
$taxstring = " Tax (7.5%): \$" . $tax . " ";
$taxstrwidth = $pdf->GetStringWidth($taxstring);
$taxstrX = 260 - $taxstrwidth;
$pdf->SetX($taxstrX);
$pdf->Cell($taxstrwidth, 6, $taxstring, 1, 1, 'C');
$pdf->SetFont('', 'B', 12);
$grandtotal = $tax + $subtotal;
$grandtotal = round($grandtotal, 2);
$grandtotal = number_format((double) $grandtotal, 2, '.', '');
$grandtotalstring = " Grand Total: \$" . $grandtotal . " ";
$grandtotstrwidth = $pdf->GetStringWidth($grandtotalstring);
$grandtotstrX = 260 - $grandtotstrwidth;
Пример #2
0
        $this->SetFont('Times', '', 12);
        $w = $this->GetStringWidth($title) + 150;
        $this->SetDrawColor(0, 0, 180);
        $this->SetFillColor(230, 0, 230);
        $this->SetTextColor(0, 0, 255);
        $this->SetLineWidth(1);
        $this->Cell($w, 9, $title, 1, 1, 'C', 1);
        $this->Ln(10);
    }
    //Page footer
    function Footer()
    {
        //Position at 1.5 cm from bottom
        $this->SetY(-15);
        $this->SetFont('Arial', 'I', 8);
        $this->Cell(0, 10, 'This is the page footer -> Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
    }
}
$title = "FPDF Library Page Header";
$pdf = new myPDF('P', 'mm', 'Letter');
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times', '', 24);
$pdf->Cell(0, 0, 'some text at the top of the page', 0, 0, 'L');
$pdf->ln(225);
$pdf->Cell(0, 0, 'More text toward the bottom', 0, 0, 'C');
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 15);
// Cell(W, H, 'text', Border, Return, 'Allign') - basic syntax
$pdf->Cell(0, 0, 'Top of page 2 after header', 0, 1, 'C');
$pdf->Output();
 //y-Position setzten
 $pdf->SetY(25);
 //Setzten des Teenstreets Logo
 $pdf->SetX(20);
 $pdf->Image("images/MN_Logo_kleiner.png", $pdf->GetX(), $pdf->GetY(), 60, 20, 'png', 'http://www.mission-net.org');
 //Zweites Logo
 $pdf->SetY(25);
 $pdf->SetX(135);
 $pdf->Image("images/MN_Logo_kleiner.png", $pdf->GetX(), $pdf->GetY(), 60, 20, 'png', 'http://www.mission-net.org');
 //Linie
 $pdf->setLineWidth(1);
 $pdf->Line(20, 45, 195, 45);
 //Cell, Anmeldung gueltig
 $pdf->SetY(50);
 $pdf->SetFont('Arial', 'B', 10);
 $pdf->Cell(0, 1, T_("Please print this page, sign it and send it to us, if you are under 18 years."), 0, 0, 'R');
 //#################HEADER END############
 //#################Mission-Net ADDRESS#######
 $pdf->SetX(20);
 $pdf->SetY(55);
 $pdf->SetFont('Arial', 'B', 12);
 $pdf->Write(5, "Mission-Net", 0, 'L');
 $pdf->ln();
 $pdf->Write(5, "Registration", 0, 'L');
 $pdf->ln();
 $pdf->Write(5, "Alte Neckarelzerstr. 2", 0, 'L');
 $pdf->ln();
 $pdf->Write(5, "D-74821 Mosbach", 0, 'L');
 $pdf->ln();
 $pdf->Write(5, "Germany", 0, 'L');
 $pdf->SetY(60);