setfont("Arial","B",10); $this->image("../pdf/bilder/swv.jpg", $this->getx(), $this->gety(), 274, 45); $this->setfont("Arial","",8); $timestamp = getdate(); $year = $timestamp['year']; $timestamp = $timestamp['mday'] . "." . $timestamp['mon'] . "." . $timestamp['year']; $this->cell($page_width - $margin_right, 14, "erstellt am $timestamp", 0, 1, "R", 0); $this->setfont("Arial","B",10); $this->sety($this->gety() + 45); $this->setfillcolor(204, 204, 204); $this->cell(0, 14, "SWV-Mitgliederliste $year", 1, 1, "C", 1); $this->ln(); } function footer() { //set y position 15 point from the page bottom border $this->sety(-15); $this->setfont("Arial","",8); $this->cell(0, 12, "Seite " . $this->pageno() . "/{total_pages}", 0, 0, "C", 0); } } $pdf=new PDF("L", "pt", "A4"); $pdf->setautopagebreak(true, $margin_bottom); $pdf->setmargins($margin_left, $margin_top, $margin_right); $pdf->aliasnbpages("{total_pages}"); $pdf->addpage("L"); if(isset($_SESSION['report_data_by_name'])) { foreach($_SESSION['report_data_by_name'] as $row) { $pdf->setfont("Arial","",8); $pdf->cell(26, 12, $row["ring_nbr"], "LTB", 0, "L", 0); $pdf->cell(70, 12, $row["last_name"], "TB", 0, "L", 0); $pdf->cell(70, 12, $row["first_name"], "TB", 0, "L", 0); $pdf->cell(120, 12, $row["address"], "TB", 0, "L", 0); $pdf->cell(40, 12, $row["zip"], "TB", 0, "L", 0); $pdf->cell(120, 12, $row["city"], "TB", 0, "L", 0); $pdf->cell(70, 12, $row["country"], "TB", 0, "L", 0); $pdf->cell(80, 12, $row["phone"], "TB", 0, "L", 0); $pdf->cell(26, 12, $row["class"], "TB", 0, "L", 0); $pdf->cell(0, 12, $row["email"], "TRB", 1, "L", 0); } } break; case "report_data_by_ring_nr": //define page size in pt $page_width = 842; $page_height = 595; //set margin $margin_left = 30; $margin_top = 20; $margin_right = 30; $margin_bottom = 30; class PDF extends FPDF { function header() { $this->setfont("Arial","B",10); $this->image("../pdf/bilder/swv.jpg", $this->getx(), $this->gety(), 274, 45); $this->setfont("Arial","",8); $timestamp = getdate(); $year = $timestamp['year']; $timestamp = $timestamp['mday'] . "." . $timestamp['mon'] . "." . $timestamp['year']; $this->cell($page_width - $margin_right, 14, "erstellt am $timestamp", 0, 1, "R", 0); $this->setfont("Arial","B",10); $this->sety($this->gety() + 45); $this->setfillcolor(204, 204, 204); $this->cell(0, 14, "SWV-Mitgliederliste $year", 1, 1, "C", 1); $this->ln(); } function footer() { //set y position 15 point from the page bottom border $this->sety(-15); $this->setfont("Arial","",8); $this->cell(0, 12, "Seite " . $this->pageno() . "/{total_pages}", 0, 0, "C", 0); } } $pdf=new PDF("L", "pt", "A4"); $pdf->setautopagebreak(true, $margin_bottom); $pdf->setmargins($margin_left, $margin_top, $margin_right); $pdf->aliasnbpages("{total_pages}"); $pdf->addpage("L"); if(isset($_SESSION['report_data_by_ring_nr'])) { foreach($_SESSION['report_data_by_ring_nr'] as $row) { $pdf->setfont("Arial","",8); $pdf->cell(26, 12, $row["ring_nbr"], "LTB", 0, "L", 0); $pdf->cell(70, 12, $row["last_name"], "TB", 0, "L", 0); $pdf->cell(70, 12, $row["first_name"], "TB", 0, "L", 0); $pdf->cell(120, 12, $row["address"], "TB", 0, "L", 0); $pdf->cell(40, 12, $row["zip"], "TB", 0, "L", 0); $pdf->cell(120, 12, $row["city"], "TB", 0, "L", 0); $pdf->cell(70, 12, $row["country"], "TB", 0, "L", 0); $pdf->cell(80, 12, $row["phone"], "TB", 0, "L", 0); $pdf->cell(26, 12, $row["class"], "TB", 0, "L", 0); $pdf->cell(0, 12, $row["email"], "TRB", 1, "L", 0); } } break; } if($pdf) { return array(true, $pdf->output("swv.pdf", "i")); } else { return array(false); } } $html = ""; $tmpfile = tempnam("/tmp", "dompdf_"); $filehandle = fopen($tmpfile); fwrite($filehandle, $html); fclose($filehandle); $url = "/pdf/dompdf-0.5.1/dompdf.php?input_file=" . rawurlencode($tmpfile) . "&paper=letter&output_file=" . rawurlencode("My Fancy PDF.pdf"); header("Location: http://" . $_SERVER["HTTP_HOST"] . "/$url"); ?>