public final function generate_attendees_PDF($tickets_list) { $this->load_pdf_libraries(); $pdf = new FPDF(); $ecp = TribeEvents::instance(); $pdf->AddFont('OpenSans', '', 'opensans.php'); $pdf->AddFont('SteelFish', '', 'steelfish.php'); $pdf->SetTitle('EventTicket'); $pdf->SetAuthor('The Events Calendar'); $pdf->SetCreator('The Events Calendar'); $defaults = array('event_id' => 0, 'ticket_name' => '', 'holder_name' => '', 'order_id' => '', 'ticket_id' => '', 'security_code' => ''); foreach ($tickets_list as $ticket) { $ticket = wp_parse_args($ticket, $defaults); $event = get_post($ticket['event_id']); $venue_id = tribe_get_venue_id($event->ID); $venue = !empty($venue_id) ? get_post($venue_id)->post_title : ''; $address = tribe_get_address($event->ID); $zip = tribe_get_zip($event->ID); $state = tribe_get_stateprovince($event->ID); $city = tribe_get_city($event->ID); $pdf->AddPage(); $pdf->SetDrawColor(28, 166, 205); $pdf->SetFillColor(28, 166, 205); $pdf->Rect(15, 10, 180, 34, 'F'); $pdf->SetTextColor(255); $pdf->SetFont('OpenSans', '', 10); $pdf->SetXY(30, 15); $pdf->Write(5, __('EVENT NAME:', 'tribe-events-calendar')); $pdf->SetXY(30, 28); $pdf->SetFont('SteelFish', '', 53); $title = strtoupper(utf8_decode($event->post_title)); $size = 53; while ($pdf->GetStringWidth($title) > 151) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $title); $pdf->SetTextColor(41); $pdf->SetFont('OpenSans', '', 10); $pdf->SetXY(30, 50); $pdf->Write(5, __('TICKET HOLDER:', 'tribe-events-calendar')); $pdf->SetXY(104, 50); $pdf->Write(5, __('LOCATION:', 'tribe-events-calendar')); $pdf->SetFont('SteelFish', '', 30); $pdf->SetXY(30, 59); $holder = strtoupper(utf8_decode($ticket['holder_name'])); $size = 30; while ($pdf->GetStringWidth($holder) > 70) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $holder); $pdf->SetXY(104, 59); $venue = strtoupper(utf8_decode($venue)); $size = 30; while ($pdf->GetStringWidth($venue) > 70) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $venue); $pdf->SetXY(104, 71); $address = strtoupper(utf8_decode($address)); $size = 30; while ($pdf->GetStringWidth($address) > 70) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $address); $pdf->SetXY(104, 83); $address2 = array($city, $state, $zip); $address2 = array_filter($address2); $address2 = join(', ', $address2); $address2 = strtoupper(utf8_decode($address2)); $size = 30; while ($pdf->GetStringWidth($address2) > 70) { $size--; $pdf->SetFontSize($size); } $pdf->Write(5, $address2); $pdf->Line(15, 97, 195, 97); $pdf->SetFont('OpenSans', '', 10); $pdf->SetXY(30, 105); $pdf->Write(5, __('ORDER:', 'tribe-events-calendar')); $pdf->SetXY(80, 105); $pdf->Write(5, __('TICKET:', 'tribe-events-calendar')); $pdf->SetXY(120, 105); $pdf->Write(5, __('VERIFICATION:', 'tribe-events-calendar')); $pdf->SetFont('SteelFish', '', 53); $pdf->SetXY(30, 118); $pdf->Write(5, $ticket['order_id']); $pdf->SetXY(80, 118); $pdf->Write(5, $ticket['ticket_id']); $pdf->SetXY(120, 118); $pdf->Write(5, $ticket['security_code']); $pdf->Rect(15, 135, 180, 15, 'F'); $pdf->SetTextColor(255); $pdf->SetFont('OpenSans', '', 10); $pdf->SetXY(30, 140); $pdf->Write(5, get_bloginfo('name')); $pdf->SetXY(104, 140); $pdf->Write(5, get_home_url()); } $upload_path = wp_upload_dir(); $upload_url = $upload_path['url']; $upload_path = $upload_path['path']; $filename = wp_unique_filename($upload_path, sanitize_file_name(md5(time())) . '.pdf'); $upload_path = trailingslashit($upload_path) . $filename; $upload_url = trailingslashit($upload_url) . $filename; $pdf->Output($upload_path, 'F'); return array($upload_path, $upload_url); }
$pdf->Cell(0, 0, utf8_decode("Edificio A-2"), 0, 1, 'R'); $pdf->Ln(4.1); $pdf->Cell(0, 0, utf8_decode("Ciudad Universitaria"), 0, 1, 'R'); $pdf->Ln(4.1); $pdf->Cell(0, 0, utf8_decode("Tegucigalpa, Honduras"), 0, 1, 'R'); $pdf->SetRightMargin(10); $pdf->SetLeftMargin(10); $pdf->Cell(18, 10, '', 0); //$pdf->Ln(20); //$pdf->SetFont('Arial', 'U', 14); //$pdf->Cell(30, 8, ' ', 0,0,"C"); //$pdf->Cell(130, 8, ' Reporte de Estudiantes', 0,0,"C"); $pdf->ln(20); $pdf->SetFont('Cambria', 'BI', 16); $pdf->Cell(0, 0, utf8_decode("Reporte de Estudiantes"), 0, 1, 'C'); $pdf->Rect(5, 55, 206, 200, 'D'); $pdf->SetFont('Arial', '', 12); $pdf->Ln(15); $pdf->Cell(115, 15, 'Fecha: ' . date('Y-m-d'), 0); $pdf->Ln(7); $pdf->Ln(5); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(25, 8, 'Cuenta', 1, 0, "C"); $pdf->Cell(30, 8, 'Identidad', 1, 0, "C"); $pdf->Cell(45, 8, 'Estudiante', 1, 0, "C"); $pdf->Cell(40, 8, 'Correo', 1, 0, "C"); $pdf->Cell(10, 8, 'Indice', 1, 0, "C"); $pdf->Cell(33, 8, utf8_decode('Mención Horifica'), 1, 0, "C"); $pdf->Cell(10, 8, 'Cant', 1, 0, "C"); $pdf->Ln(8); $pdf->SetFont('Arial', '', 8);
/** * * View detail of persuratan_suratmasuk * **/ function action_persuratan_suratmasukcetakld($id) { $this->blankpage = true; $this->db_query("SELECT * FROM persuratan_ms_flowstat"); while ($row = $this->db_fetch()) { $arr_ms_flowstat[$row['id']] = $row['name']; } $this->db_query("SELECT * FROM persuratan_ms_tipesurat"); while ($row = $this->db_fetch()) { $arr_ms_tipesurat[$row['id']] = $row['name']; } $this->db_query("SELECT * FROM persuratan_ms_sifatsurat"); while ($row = $this->db_fetch()) { $arr_ms_sifatsurat[$row['id']] = $row['name']; } $this->db_query("SELECT * FROM persuratan_ms_tujuanakhir"); while ($row = $this->db_fetch()) { $arr_ms_tujuanakhir[$row['id']] = $row['name']; } $res = $this->db_query("SELECT * , DATE_FORMAT(tglagenda, '%d-%m-%Y') AS tglagenda, DATE_FORMAT(tglsuratintern, '%d-%m-%Y') AS tglsuratintern, DATE_FORMAT(tglkma, '%d-%m-%Y') AS tglkma, DATE_FORMAT(tglsuratpengirim, '%d-%m-%Y') AS tglsuratpengirim, DATE_FORMAT(tglpembukuan, '%d-%m-%Y') AS tglpembukuan, DATE_FORMAT(tglmasuktuadawas, '%d-%m-%Y') AS tglmasuktuadawas, DATE_FORMAT(tglkeluar, '%d-%m-%Y') AS tglkeluar FROM persuratan_suratmasuk \n WHERE ms_tujuanakhir_id='{$id}' AND ms_flowstat_id = 101\n {$this->groupfield} ORDER BY tglagenda DESC"); $this->db_query("SELECT * , DATE_FORMAT(tglagenda, '%d-%m-%Y') AS tglagenda, DATE_FORMAT(tglsurat, '%d-%m-%Y') AS tglsurat FROM persuratan_suratmasuk WHERE ms_tujuanakhir_id='{$id}' AND ms_flowstat_id = 101 {$this->groupfield} ORDER BY tglagenda DESC, id DESC"); if ($this->db_numrows() > 0) { //============== // Start create PDF //============== require 'fpdf/fpdf.php'; $pdf = new FPDF('P', 'mm', array(215, 330)); $pdf->SetAuthor('Agus Sudarmanto, S.Kom.'); while ($row = $this->db_fetch()) { $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 16); $cellBox = 195; $pdf->Rect(10, 7, $cellBox, 25); $pdf->Rect(10, 38, $cellBox, 24); $pdf->Rect(150, 38, 55, 24); $pdf->Rect(10, 62, $cellBox, 50); $pdf->Rect(10, 118, $cellBox, 133); $pdf->Rect(150, 118, 55, 133); $pdf->Cell($cellBox, 7, 'MAHKAMAH AGUNG REPUBLIK INDONESIA', 0, 1, 'C'); $pdf->Cell($cellBox, 7, 'SEKRETARIAT WAKIL KETUA MA BIDANG NON YUDISIAL', 0, 1, 'C'); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell($cellBox, 7, 'Lembar Disposisi', 0, 1, 'C'); $pdf->Image('pdf/logo.png', 23, 10, 16); $pdf->SetFont('Arial', '', 10); $arr = array(array('Nomor Agenda', $row[noagenda]), array('Tanggal Agenda', $row[tglagenda]), array('Agno TU', $row[nosuratintern]), array('Tanggal TU', $row[tglsuratintern]), array('', ''), array('Nomor Surat', $row[nosuratpengirim]), array('Tanggal', $row[tglsuratpengirim]), array('Pengirim', $row[namapengirim]), array('Perihal', $row[perihal])); $pdf->SetY(40); for ($i = 0, $c = sizeof($arr); $i < $c; $i++) { $pdf->SetX(13); $pdf->Cell(31, 5, $arr[$i][0]); $pdf->Cell(5, 5, !in_array($i, array(4, 9)) ? ':' : ''); $pdf->MultiCell($i < 5 ? 100 : 158, 5, $arr[$i][1], 0, 1); } $pdf->SetY(45); $arr = array(array('Jenis Surat', $arr_ms_sifatsurat[$row['ms_sifatsurat_id']])); for ($i = 0, $c = sizeof($arr); $i < $c; $i++) { $pdf->SetX(155); $pdf->Cell(20, 5, $arr[$i][0]); $pdf->Cell(5, 5, ':'); if ($i == 0) { $pdf->SetFont('', 'B'); } $pdf->MultiCell(70, 5, $arr[$i][1], 0, 1); if ($i == 0) { $pdf->SetFont('', ''); } } $arr = array(array('Diteruskan kepada :'), array('KMA RI'), array('WKMA RI Bid. Yud'), array('WKMA RI Bid. Non Yud'), array('Para Tuaka'), array('Kabawas'), array('Lainnya')); $pdf->SetY(120); for ($i = 0, $c = sizeof($arr); $i < $c; $i++) { $pdf->SetX($i == 0 ? 155 : 163); $pdf->Cell(31, 7, $arr[$i][0], 0, 1); } $pdf->SetFont('Arial', '', 8); $pdf->SetY(251); for ($i = 0; $i < 6; $i++) { $pdf->Rect(157, 128 + $i * 7, 4, 4); } $pdf->SetY(150); $pdf->SetX(130); } $pdf->Output(); $res = $this->db_query("UPDATE persuratan_suratmasuk \n SET ms_flowstat_id = 102\n WHERE ms_tujuanakhir_id='{$id}' AND ms_flowstat_id = 101"); } }
public function drawPDF() { $pdf = new \FPDF('P', 'mm', 'Letter'); $pdf->SetMargins(0, 3.175, 0); $pdf->SetAutoPageBreak(false); define('FPDF_FONTPATH', dirname(__FILE__) . '/noauto/fonts/'); $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php'); $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php'); $pdf->AddFont('GillBook', '', 'GillSansMTPro-Book.php'); $pdf->SetFont('Gill', '', 16); $data = $this->loadItems(); $count = 0; $sign = 0; $width = 53.975; $height = 68.95999999999999; $top = 20; $left = 5.175; $effective_width = $width - 2 * $left; $pdf->SetDrawColor(0, 0, 0); $pdf->SetLineWidth(0.2); foreach ($data as $item) { if ($count % 16 == 0) { $pdf->AddPage(); // draw tick marks for cutting $pdf->Line(2, $height + 1.5, 6, $height + 1.5); $pdf->Line(2, 2 * $height + 1.5, 6, 2 * $height + 1.5); $pdf->Line(2, 3 * $height + 1.5, 6, 3 * $height + 1.5); $pdf->Line($width, 2, $width, 6); $pdf->Line(2 * $width, 2, 2 * $width, 6); $pdf->Line(3 * $width, 2, 3 * $width, 6); $pdf->Line($width, 4 * $height - 4, $width, 4 * $height); $pdf->Line(2 * $width, 4 * $height - 4, 2 * $width, 4 * $height); $pdf->Line(3 * $width, 4 * $height - 4, 3 * $width, 4 * $height); $pdf->Line(4 * $width - 6, $height + 1.5, 4 * $width - 2, $height + 1.5); $pdf->Line(4 * $width - 6, 2 * $height + 1.5, 4 * $width - 2, 2 * $height + 1.5); $pdf->Line(4 * $width - 6, 3 * $height + 1.5, 4 * $width - 2, 3 * $height + 1.5); $sign = 0; } $row = floor($sign / 4); $column = $sign % 4; $price = $item['normal_price']; if ($item['scale']) { if (substr($price, 0, 1) != '$') { $price = sprintf('$%.2f', $price); } $price .= ' /lb.'; } elseif (isset($item['signMultiplier'])) { $price = $this->formatPrice($item['normal_price'], $item['signMultiplier']); } else { $price = $this->formatPrice($item['normal_price']); } $pdf->Image(dirname(__FILE__) . '/cd_head_16.png', $left - 2 + $width * $column, $top - 17 + $row * $height, $width - 6); $pdf->SetXY($left + $width * $column, $top + $row * $height - 2); $pdf->SetFont('Gill', 'B', $this->SMALL_FONT); $font_shrink = 0; while (true) { $pdf->SetX($left + $width * $column); $y = $pdf->GetY(); $pdf->MultiCell($effective_width, 6, strtoupper($item['brand']), 0, 'C'); if ($pdf->GetY() - $y > 6) { $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $font_shrink++; if ($font_shrink >= $this->SMALL_FONT) { break; } $pdf->SetFontSize($this->MED_FONT - $font_shrink); $pdf->SetXY($left + $width * $column, $y); } else { break; } } $pdf->SetX($left + $width * $column); $pdf->SetFont('Gill', '', $this->MED_FONT); $font_shrink = 0; while (true) { $pdf->SetX($left + $width * $column); $y = $pdf->GetY(); $pdf->MultiCell($effective_width, 6, $item['description'], 0, 'C'); if ($pdf->GetY() - $y > 12) { $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $font_shrink++; if ($font_shrink >= $this->MED_FONT) { break; } $pdf->SetFontSize($this->MED_FONT - $font_shrink); $pdf->SetXY($left + $width * $column, $y); } else { if ($pdf->GetY() - $y < 12) { $words = explode(' ', $item['description']); $multi = ''; for ($i = 0; $i < floor(count($words) / 2); $i++) { $multi .= $words[$i] . ' '; } $multi = trim($multi) . "\n"; for ($i = floor(count($words) / 2); $i < count($words); $i++) { $multi .= $words[$i] . ' '; } $item['description'] = trim($multi); $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $pdf->SetXY($left + $width * $column, $y); $pdf->MultiCell($effective_width, 6, $item['description'], 0, 'C'); } break; } } $pdf->SetX($left + $width * $column); $pdf->SetFont('GillBook', '', $this->SMALLER_FONT); $item['size'] = strtolower($item['size']); if (substr($item['size'], -1) != '.') { $item['size'] .= '.'; // end abbreviation w/ period $item['size'] = str_replace('fz.', 'fl oz.', $item['size']); } if (substr($item['size'], 0, 1) == '.') { $item['size'] = '0' . $item['size']; // add leading zero on decimal qty } if (strlen(ltrim($item['upc'], '0')) < 5 && $item['scale']) { $item['size'] = 'PLU# ' . ltrim($item['upc'], '0'); // show PLU #s on by-weight } $pdf->Cell($effective_width, 6, $item['size'], 0, 1, 'C'); $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - $top - 18)); $pdf->SetFont('Gill', '', $this->BIG_FONT); $pdf->MultiCell($effective_width, 10, $price, 0, 'C'); if ($item['startDate'] != '' && $item['endDate'] != '') { // intl would be nice $datestr = date('M d', strtotime($item['startDate'])) . chr(0x96) . date('M d', strtotime($item['endDate'])); $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - $top - 7)); $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT); $pdf->Cell($effective_width + 4, 6, strtoupper($datestr), 0, 1, 'R'); } if ($item['upc'] != '') { $pdf->SetXY($left - 2 + $width * $column, $top + $height * $row + ($height - $top - 7)); $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT); $pdf->Cell($effective_width, 6, $item['upc'], 0, 1, 'L'); } $pdf->Image(dirname(__FILE__) . '/' . $this->footer_image, $left - 2 + $width * $column, $top + $height * $row + ($height - $top - 2), $width - 6); $count++; $sign++; } $pdf->Output('Signage16UpP.pdf', 'I'); }
function pdf_export_dots(&$dots, &$more) { # PLEASE FOR TO BE CACHING ME, OBIWAN... # (20110120/straup) $w = 11; $h = 8.5; $margin = 0.5; $dpi = 72; $header_h = 0.2; $row_h = 0.2; $col_width = 1.25; # Here we go... $pdf = new FPDF("P", "in", array($w, $h)); $pdf->setMargins($margin, $margin); # The legend gets added below (once we've figured out what page # each dot is on) but we'll just declare it here. $legend = array(); $count_legend_items = floor($h / ($row_h * 1.4)); $count_clusters = ceil(count($dots) / $count_legend_items); # Just turn clusters off for now... the map rendering time # is still too long for multiple map images (20110120/straup) $count_clusters = 1; $clusters = array(); if ($count_clusters == 1) { $clusters = array($dots); } else { $points = array(); $i = 0; foreach ($dots as $dot) { $points[] = array('x' => (double) $dot['longitude'], 'y' => (double) $dot['latitude'], 'id' => $dot['id'], 'idx' => $i); $i++; } $_clusters = kmeans_cluster($points, $count_clusters); foreach ($_clusters as $_cluster) { $_dots = array(); foreach ($_cluster as $_pt) { $_dots[] = $dots[$pt['idx']]; } $clusters[] = $_dots; } } # # First generate all the maps # $maps = array(); $img_more = array('width' => $h * $dpi, 'height' => $h * $dpi, 'dot_size' => 15); foreach ($clusters as $dots) { list($map, $gd_img) = maps_image_for_dots($dots, $img_more); $maps[] = maps_gd_to_png($gd_img, 'pdf'); } # Now figure out the what is the what of the dots $columns = array(); $cols_per_page = floor(($w - $margin * 2) / $col_width); $count_cols = count($more['columns']); $pages_per_row = ceil($count_cols / $cols_per_page); # See this? We're adding enough extra columns and re-counting # everything in order to ensure that every page for each row # has an 'id' column if ($pages_per_row > 1) { $_count = $count_cols + ($pages_per_row - 1); $pages_per_row = ceil($_count / $cols_per_page); } # First, chunk out the header in (n) pages and measure the # height of the (header) row itself $_h = $header_h * 1.3; $pdf->SetFont('Helvetica', 'B', 10); for ($i = 0; $i < $count_cols; $i++) { $col_name = $more['columns'][$i]; $b = floor($i / $cols_per_page); if (!is_array($columns[$b])) { $columns[] = array(); } $columns[$b][] = $col_name; $str_width = ceil($pdf->GetStringWidth($more['columns'][$i])); if ($str_width > $col_width) { $lines = ceil($str_width / $col_width); $_h = max($_h, $lines * $header_h); } } $header_h = $_h; # make sure every page has an 'id' field # (see above) $count_columns = count($columns); for ($i = 0; $i < $count_columns; $i++) { $cols = $columns[$i]; if (!in_array('id', $cols)) { array_unshift($cols, 'id'); $columns[$i] = $cols; } # move stuff around so that we keep the pages nice and tidy if (count($columns[$i]) > $cols_per_page) { $to_keep = array_slice($columns[$i], 0, $cols_per_page); $extra = array_slice($columns[$i], $cols_per_page); $columns[$i] = $to_keep; $columns[$i + 1] = $extra; } } # Now work out the height of each row of dots $row_heights = array(); $pdf->SetFont('Helvetica', '', 10); foreach ($dots as $dot) { $_h = $row_h; foreach ($dot as $key => $value) { $str_width = ceil($pdf->GetStringWidth($value)); if ($str_width > $col_width) { $lines = ceil($str_width / $col_width); $_h = max($_h, $lines * $row_h); } } $row_heights[] = $_h * 1.1; } # Now sort everything in to pages $pages = array(); $page = 0; $count_dots = count($dots); $dot_idx = 0; $y = $margin + $header_h; while ($dot_idx < $count_dots) { $dot = $dots[$dot_idx]; $row_height = $row_heights[$dot_idx]; # will this row bleed off the current page ($page) ? $goto_nextpage = 0; if ($y + $row_height > $h - $margin * 1.5) { $goto_nextpage = 1; } if ($goto_nextpage) { $page += $pages_per_row; $y = $margin + $header_h; } $y += $row_height; # set up information for legend $legend[$dot['id']] = array('page' => $page + 2, 'id' => $dot['id'], 'latitude' => $dot['latitude'], 'longitude' => $dot['longitude'], 'ymd' => gmdate('Y-m-d', strtotime($dot['created']))); # $j = 0; foreach ($columns as $cols) { $_row = array(); foreach ($cols as $name) { $_row[] = $dot[$name]; } $page_idx = $page + $j; if (!is_array($pages[$page_idx])) { $pages[$page_idx] = array(array('row' => $cols, 'bold' => 1, 'height' => $header_h)); } $pages[$page_idx][] = array('row' => $_row, 'height' => $row_height); $j++; } $dot_idx++; } # # ZOMG... finally publish the thing... # # First, display all the maps and corresponding # legends function sort_by_lat($a, $b) { if ($a['latitude'] == $b['latitude']) { return 0; } return $a['latitude'] > $b['latitude'] ? -1 : 1; } $count_clusters = count($clusters); for ($i = 0; $i < $count_clusters; $i++) { $dots = $clusters[$i]; $_legend = array(); $j = 0; foreach ($dots as $dot) { $_legend[$dot['id']] = $legend[$dot['id']]; $j++; if ($j >= $count_legend_items) { break; } } usort($_legend, "sort_by_lat"); $pdf->AddPage(); $pdf->Image($maps[$i], 0, 0, 0, 0, 'PNG'); $pdf->SetFont('Helvetica', '', 10); $x = $h + $margin; $y = $margin; foreach ($_legend as $dot) { $text = "{$dot['id']} / pg. {$dot['page']}"; $pdf->SetXY($x, $y); $pdf->Cell(0, $row_h, $text); $loc = new MMaps_Location($dot['latitude'], $dot['longitude']); $pt = $map->locationPoint($loc); $x1 = $x - $margin / 8; $y1 = $y + $row_h / 2; $x2 = $pt->x / $dpi; $y2 = $pt->y / $dpi; $pdf->Line($x1, $y1, $x2, $y2); $y += $row_h * 1.1; } } # Now the rows (of dots) foreach ($pages as $page) { $pdf->AddPage(); $x = $margin; $y = $margin; $z = 0; foreach ($page as $data) { $style = $data['bold'] ? 'B' : ''; $pdf->SetFont('Helvetica', $style, 10); $x_offset = $col_width * 0.1; $y_offset = $data['height'] * 0.1; $max_width = $col_width - $x_offset * 3; $bg = $z % 2 ? 255 : 235; $z++; foreach ($data['row'] as $value) { $value = trim($value); $width = $pdf->GetStringWidth($value); $pdf->SetFillColor($bg); $pdf->Rect($x, $y, $col_width, $data['height'], 'F'); # Don't bother with MultiCell - it is behaving # badly (20110120/straup) if ($width < $max_width) { $pdf->SetXY($x + $x_offset, $y + $y_offset); $pdf->Cell(0, $row_h, $value); } else { $_x = $x; $_y = $y; $lines = array(); $buffer = ''; foreach (str_split($value) as $char) { if ($buffer == '' && $char == ' ') { continue; } $buffer .= $char; $width = $pdf->GetStringWidth($buffer); if ($width >= $max_width) { $lines[] = $buffer; $buffer = ''; } } if (strlen($buffer)) { $lines[] = $buffer; $buffer = ''; } foreach ($lines as $ln) { $pdf->SetXY($_x + $x_offset, $_y + $y_offset); $pdf->Cell(0, $row_h, $ln); $_y += $row_h * 0.8; } } $x += $col_width; } $x = $margin; $y += $data['height']; } } # Go! $pdf->Close(); $pdf->Output($more['path'], 'F'); $pdf = null; foreach ($maps as $map_img) { if (!unlink($map_img)) { error_log("[EXPORT] (pdf) unlink {$map_img} : {$ok}"); } } return $more['path']; }
function rect($x1, $y1, $width, $height, $filled = FALSE, $rounded = 0) { if ($rounded > 0) { $this->rect_rounded($this->flash_y_offset + $y1, $this->flash_x_offset + $x1, $width, $height, $rounded, $filled ? "F" : ""); } else { parent::Rect($this->flash_y_offset + $y1, $this->flash_x_offset + $x1, $width, $height, $filled ? "F" : ""); } // end if }
$image12 = "done2.png"; $logo = "logo.png"; // Add a page to that object $pdf->AddPage(); $pdf->setleftmargin(10); $pdf->setX(10); $pdf->setY(10); // Add some text $pdf->SetFont('Arial', 'B', 10); $text = "hello"; // width, height, text, no border, next line - below & left margin, alignement // shree rang in centre $pdf->Cell(200, 10, '|| Shree Rang ||', 0, 1, "C"); //create rectangle and registration form $pdf->SetFillColor(0, 0, 0); $pdf->Rect(0, 20, 210, 10, 'F'); $pdf->SetTextColor(255, 255, 255); $pdf->SetFont('Arial', 'B', 15); $pdf->Cell(200, 10, 'REGISTRATION FORM - 2016', 0, 1, "C"); // space below registration form $pdf->Cell(210, 5, '', 0, 1, "C"); //set font and height $pdf->SetFont('Arial', 'B', 12); $pdf->SetTextColor(0, 0, 0); //space before form no. $pdf->Cell(10, 5, '', 0, 0, "C"); $pdf->Cell(5, 5, 'FORM NO.', 0, 0, "C"); //space between rect and form no tag $pdf->Cell(10, 5, '', 0, 0, "C"); // create box for form $pdf->Cell(30, 5, $form, 1, 0, "C");
<?php require 'fpdf.php'; $nom = "Marc Prats"; $pdf = new FPDF('L', 'mm', 'A4'); $pdf->AddPage(); $pdf->SetFillColor(255, 0, 0); for ($x = 0; $x < 8; $x++) { for ($y = 0; $y < 12; $y++) { $pdf->Rect(5 + $x * 36, 14 + $y * 16, 34, 12, 'F'); } } $pdf->SetFillColor(255, 255, 255); //$pdf->SetFillColor(0,0,0); for ($x = 0; $x < 8; $x++) { for ($y = 0; $y < 12; $y++) { $pdf->Rect(6 + $x * 36, 15 + $y * 16, 32, 10, 'F'); } } // $pdf->SetFont('Arial','B',16); // $pdf->Cell(40,10,$nom); // $pdf->Cell(40,10,$nom); // $pdf->Cell(40,10,$nom); // $pdf->Cell(40,10,$nom); // $pdf->Cell(40,10,$nom); // $pdf->Ln(20); // $pdf->Cell(40,10,$nom); // $pdf->Cell(40,10,$nom); // $pdf->Cell(40,10,$nom); // $pdf->Cell(40,10,$nom); // $pdf->Cell(40,10,$nom);
$query2->execute();*/ $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial', '', 18); $pdf->Image($maindir . 'assets/img/lucen-aspicio.png', 50, 30, 200, 200, 'PNG'); $pdf->Image($maindir . 'assets/img/logo_unah.png', 10, 5, 18, 30, 'PNG'); $pdf->Image($maindir . 'assets/img/logo-cienciasjuridicas.png', 170, 8, 25, 25, 'PNG'); $pdf->Cell(22, 10, '', 0); $pdf->SetFont('Arial', '', 18); $pdf->Cell(5, 10, '', 0); $pdf->Cell(70, 10, utf8_decode('Universidad Nacional Autónoma de Honduras'), 0); $pdf->Ln(15); $pdf->SetFont('Arial', 'U', 14); $pdf->Cell(25, 8, '', 0, 0, "C"); $pdf->Cell(130, 8, ' Control de Permisos Personales', 0, 0, "C"); $pdf->Rect(6, 37, 200, 95, 'D'); $pdf->SetFont('Arial', '', 12); $pdf->Ln(10); $nombreCompleto = "{$result['Primer_nombre']} {$result['Segundo_nombre']} {$result['Primer_apellido']} {$result['Segundo_Apellido']}"; $pdf->Cell(100, 15, 'Nombre: ' . $nombreCompleto, 0, 0, ""); $pdf->Cell(40, 15, 'No.De Empleado: ' . $result['No_Empleado'], 0, 0, ""); $pdf->Ln(7); $pdf->Cell(150, 15, utf8_decode('Unidad Académica: ') . $result['nombre_departamento'], 0); $pdf->Ln(7); $pdf->Cell(140, 15, 'Solicitud de permiso por motivo de: ' . $result['mtd'], 0, 0, ""); $pdf->Ln(7); $pdf->Cell(140, 15, 'Edificio de Registro de Asistencia: ' . $result['descripcion'], 0, 0, ""); $pdf->Ln(7); $pdf->Cell(125, 15, utf8_decode('Duración en dias: ') . $result['dias_permiso'], 0, 0, ""); $pdf->Ln(7); $pdf->Cell(40, 15, 'Fecha: ' . $result['fecha'], 0, 0, "");
$productTop = $productTop + $down; $endDateTop = $endDateTop + $down; } /** * instantiate variables for printing on barcode from * $testQ query result set */ $product = ucwords(strtolower($row['description'])); $brand = ucwords(strtolower($row['brand'])); $nprice = '$' . number_format($row['nprice'], 2); $sprice = '$' . number_format($row['sprice'], 2); /** * begin creating tag */ $pdf->SetLineWidth(0.2); $pdf->Rect($x, $y, $w, $h - 4); $pdf->Image('peoples_sale_1up.jpg', $x, $y, $w, $h - 4); $pdf->SetFont('Arial', '', 11); $pdf->SetXY($x, $brandTop); $pdf->Cell($w, 8, $brand, 0, 0, 'C'); // $pdf->SetLineWidth(.4); // $pdf->Line($lineStartX, $lineStartY, $lineStopX, $lineStopY); $pdf->SetFont('Arial', 'B', 42); $pdf->SetXY($priceLeft, $spriceTop); // $pdf->Cell($w-25.4,4,'Sale Price',0,0,'L'); // $pdf->SetXY($priceLeft,$spriceTop); $pdf->Cell($w - 25.4, 4, $sprice, 0, 0, 'C'); $pdf->SetFont('Arial', '', 14); $pdf->SetXY($priceLeft, $npriceTop); $pdf->Cell($w - 25.4, 4, 'Regular Price ' . $nprice, 0, 0, 'C'); // $pdf->SetXY($priceLeft,$npriceTop);
//Fecha - Modificación $pdf->Line(75, 220.5, 140, 220.5); //Firma de Autorización /*********************** Firmas del Documento ***************************/ $pdf->Line(13, 234.5, 69, 234.5); //Solicitante (241.5) $pdf->Line(147, 234.5, 203, 234.5); //Comisión Autorizada por $pdf->Line(13, 249.5, 69, 249.5); //Registro Departamento de Recursos Financieros (261.5) $pdf->Line(147, 249.5, 203, 249.5); //Subjefe Administrativo /*********************** FIN LINEAS *******************************/ /*********************** INICIO RECTÁNGULOS ***********************/ //Rectángulo izq sup der inf $pdf->Rect(147, 48.5, 3, 3); //Cuadro1 Presupuesto Estatal [*] $pdf->Rect(173, 48.5, 3, 3); //Cuadro2 Presupuesto Federal [*] $pdf->Rect(44, 96, 3, 3); //Cuadro1 Pago Efectivo [*] $pdf->Rect(43.5, 112, 3, 3); //Cuadro2 pago Tarjeta [*] $pdf->Rect(34, 180.5, 3, 3); //Cuadro 1 Viático Tipo de Ampliación [*] $pdf->Rect(74, 180.5, 3, 3); //Cuadro 2 Viat-24hrs Tipo de Ampliación [*] $pdf->Rect(104, 180.5, 3, 3); //Cuadro 3 Gasolina Tipo de Ampliación [*] $pdf->Rect(134, 180.5, 3, 3); //Cuadro 4 Peaje Tipo de Ampliación [*]
$pdf->SetAutoPageBreak(false); $pdf->AddPage(); $y_axis_initial = 5; $y_axis1 = 5; $data = mysql_query("SELECT * from tblmhs where nim='{$_GET['id']}'"); $i = 0; $max = 25; $row_height = 5; $row = mysql_fetch_array($data); $tgl_lahir = explode("-", $row['tanggal']); $pdf->SetDrawColor(50, 0, 0, 0); $pdf->SetFillColor(300, 0); $pdf->SetFont('Arial', 'B', 10); $pdf->SetY($y_axis1); //$pdf->SetX(25); $pdf->Rect(9.75, 4.0, 90, 62, 'D'); $pdf->Line(9.65, 17.5, 99.5, 17.5); $pdf->Rect(105, 4.0, 90, 62, 'D'); $pdf->Cell(89, 6, 'KARTU TANDA MASUK GEDUNG', 0, 0, 'C', 1); $pdf->Cell(6.5); $pdf->Cell(89, 6, 'PERHATIAN', 0, 0, 'C', 0); $pdf->Ln(); $pdf->Cell(89, 6, 'TELKOMSEL', 0, 0, 'C', 1); $pdf->Cell(6.5); $pdf->Cell(89, 6, ' ', 0, 0, 'C', 0); //$pdf->Line(100, 4, 100, 83); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont('Arial', '', 10); //konversi tgl tes $img_file = 'download.jpg';
$pfecha = $_SESSION["FECHA"]; } if (isset($_SESSION["TIPO_SOLICITUD"])) { $tipoSolicitud = $_SESSION["TIPO_SOLICITUD"]; } $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial', '', 18); $pdf->Image($maindir . 'assets/img/cabecera.png', -2, 5, 212, 30, 'PNG'); $pdf->Image($maindir . 'assets/img/lucen-aspicio.png', 78, 85, 200, 200, 'PNG'); $pdf->Cell(18, 10, '', 0); $pdf->Ln(30); $pdf->SetFont('Arial', 'U', 14); $pdf->Cell(30, 8, ' ', 0, 0, "C"); $pdf->Cell(130, 8, ' Reporte de Estudiantes', 0, 0, "C"); $pdf->Rect(2, 55, 206, 200, 'D'); $pdf->SetFont('Arial', '', 12); $pdf->Ln(15); $pdf->Cell(115, 15, 'Fecha: ' . date('Y-m-d'), 0); $pdf->Ln(7); $pdf->Ln(5); $pdf->SetFont('Arial', 'B', 8); $pdf->Cell(25, 8, 'Cuenta', 1, 0, "C"); $pdf->Cell(30, 8, 'Identidad', 1, 0, "C"); $pdf->Cell(45, 8, 'Estudiante', 1, 0, "C"); $pdf->Cell(40, 8, 'Correo', 1, 0, "C"); $pdf->Cell(10, 8, 'Indice', 1, 0, "C"); $pdf->Cell(33, 8, 'Mencion Horifica', 1, 0, "C"); $pdf->Cell(10, 8, 'Cant', 1, 0, "C"); $pdf->Ln(8); $pdf->SetFont('Arial', '', 8);
/** * Generate one PDF page with the parsed elements * @author Pablo Dall'Oglio */ public function generate() { $this->AddPage($this->orientation, $this->format); $style = ''; foreach ($this->elements as $element) { if (isset($element['class'])) { switch ($element['class']) { case 'Rectangle': if ($element['shadowoffset'] > 0) { $this->setFillColorRGB($element['shadowcolor']); $this->Rect($element['x'] + $element['shadowoffset'], $element['y'] + $element['shadowoffset'], $element['width'], $element['height'], 'F'); } parent::SetLineWidth($element['linewidth']); $this->setDrawColorRGB($element['linecolor']); $this->setFillColorRGB($element['fillcolor']); $mode = $element['linewidth'] > 0 ? 'FD' : 'F'; parent::Rect($element['x'], $element['y'], $element['width'], $element['height'], $mode); break; case 'Ellipse': $x = $element['x'] + $element['width'] / 2; $y = $element['y'] + $element['height'] / 2; if ($element['shadowoffset'] > 0) { $fillc = $this->rgb2int255($element['shadowcolor']); parent::SetFillColor($fillc[0], $fillc[1], $fillc[2]); $this->ellipse($x + $element['shadowoffset'], $y + $element['shadowoffset'], $element['width'] / 2, $element['height'] / 2, 'F'); } $mode = $element['linewidth'] > 0 ? 'FD' : 'F'; parent::SetLineWidth($element['linewidth']); $this->setDrawColorRGB($element['linecolor']); $this->setFillColorRGB($element['fillcolor']); $this->ellipse($x, $y, $element['width'] / 2, $element['height'] / 2, $mode); break; case 'Text': $height_factor['Courier'] = 0.335; $height_factor['Arial'] = 0.39; $height_factor['Times'] = 0.42; $text = str_replace(array_keys($this->replaces), array_values($this->replaces), $element['text']); $x = $element['x'] - 2; $y = $element['y'] + $element['size'] * $height_factor[$element['font']] - 30 * (1 / $element['size']); if ($element['shadowoffset'] > 0) { $this->setFontColorRGB($element['shadowcolor']); parent::SetFont($element['font'], $style, $element['size']); $this->writeHTML($x + $element['shadowoffset'], $y + $element['shadowoffset'], $text); } parent::SetFont($element['font'], $style, $element['size']); $this->setFontColorRGB($element['color']); $this->writeHTML($x, $y, $text); break; case 'Line': parent::SetLineWidth($element['linewidth']); $this->setDrawColorRGB($element['linecolor']); parent::Line($element['x'], $element['y'], $element['x2'], $element['y2']); break; case 'Image': if (file_exists($element['file'])) { parent::Image($element['file'], $element['x'], $element['y'], $element['width'], $element['height']); } break; } } } }
$hUnderlineOffset = 7.15; $wSpace = 5; $hTwoLinesOffset = 5.5; //*************** //** PDF Build ** //*************** require_once "resources/includePath.inc"; require 'fpdf17/fpdf.php'; $pdf = new FPDF(); //default to mm units $pdf->AddFont('Porcelain', '', 'Porcelain.php'); $pdf->AddFont('DemiTasse', '', 'DemiTasse.php'); $pdf->AddPage('P', 'Letter'); //** Draw Page Outline Box ** $pdf->SetDrawColor(230, 230, 230); $pdf->Rect($xMarginLeft, $yMarginTop, $xMarginRight - $xMarginLeft, $yMarginBottom - $yMarginTop); //************************* //** Write Page Elements ** //************************* //** Images ** $imgScaleBorder = 97; $imgScaleWatermark = 75; $imgSpacingBorder = 1.5; $pdf->Image('resources/certificates/border_L.png', $xMarginLeft + $imgSpacingBorder, $yMarginTop + $imgSpacingBorder, $imgScaleBorder); $pdf->Image('resources/certificates/watermark_light.png', ($wTextArea - $imgScaleWatermark) / 2 + $xLeftTextMargin, $yMarginTop + 7, $imgScaleWatermark); $pdf->Image('resources/certificates/border_R.png', $xMarginRight - $imgSpacingBorder - $imgScaleBorder, $yMarginBottom - $imgSpacingBorder - $imgScaleBorder, $imgScaleBorder); //** Title ** $yLine = $yMarginTop + 16; $pdf->SetFont('Porcelain', '', 42); $pdf->SetY($yLine); $pdf->Cell(0, 10, $textTitle, 0, 1, 'C');
$totalded = 0; $linea = 65; while($ren = mysql_fetch_array($res)) { if($ren["tipo"] == "D") { $pdf->Text(107, $linea, $ren["cve_concepto"] . " " . $ren["concepto"]); $pdf->Text(173, $linea, campo(number_format($ren["importe"], 2, ".", ","), 20, 2)); $totalded += $ren["importe"]; $linea += 3; } } $pdf->SetDrawColor(0,0,0); $pdf->Rect(4, 60, 100, 30); $pdf->Rect(104, 60, 100, 30); $pdf->Text(5, 95, "TOTAL DE PERCEPCIONES:"); $pdf->Text(72, 95, campo(number_format($totalper, 2, ".", ","), 20, 2)); $pdf->Text(107, 95, "TOTAL DE DEDUCCIONES:"); $pdf->Text(173, 95, campo(number_format($totalded, 2, ".", ","), 20, 2)); $pdf->Text(107, 100, "NETO A PAGAR:"); $pdf->Text(173, 100, campo(number_format($totalper - $totalded, 2, ".", ","), 20, 2)); $pdf->SetFont('Arial','',7); $pdf->Text(107, 108, "Recibí la cantidad indicada que cubre a la fecha todas las percepciones que tengo"); $pdf->Text(107, 111, "derecho sin que se me adeude cantidad alguna."); $pdf->Rect(104, 104, 100, 9);
foreach ($information as $val) { switch ($val["type"]) { case "SetRightMargin": $pdf->SetRightMargin($val[0]); break; case "SetTopMargin": $pdf->SetTopMargin($val[0]); break; case "MultiCell": $pdf->MultiCell($val[0], $val[1], $val[2], $val[3], $val[4]); break; case "SetXY": $pdf->SetXY($val[0], $val[1]); break; case "Rect": $pdf->Rect($val[0], $val[1], $val[2], $val[3]); break; case "setFont": $pdf->setFont($val[0], $val[1], $val[2]); break; case "Text": $pdf->Text($val[0], $val[1], $val[2]); break; } } foreach ($bottom as $val) { switch ($val["type"]) { case "MultiCell": $pdf->MultiCell($val[0], $val[1], $val[2], $val[3], $val[4]); break; case "Rect":
$pdf->Cell(30,7,$lafila["serie"] . str_pad($lafila["folio"], 10, "0", STR_PAD_LEFT),1,0,'C',1); $pdf->Ln(4); $pdf->Ln(10); $pdf->SetFillColor(255,255,255); $pdf->SetTextColor(0); $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(.2); $pdf->SetFont('Arial','B',10); $pdf->Cell(40,65,''); $pdf->SetX(10); $pdf->Rect(11, 53, 193, 23); $pdf->Cell(8); $pdf->Cell(19,4,"Nombre: ",'',0,'L',1); $pdf->SetFillColor(220,220,220); $pdf->Cell(156,4,"$lafila[rsocial]",'',0,'L',1); $pdf->SetFillColor(255,255,255); $pdf->Ln(5); $pdf->Cell(8); $pdf->Cell(22,4,"Domicilio: ",'',0,'L',1); $pdf->SetFillColor(220,220,220); $pdf->Cell(153,4,"$lafila[direccion]",'',0,'L',1); $pdf->SetFillColor(255,255,255); $pdf->Ln(5);
$position_rec = $position->getPosition(1); $candidate = new Candidate(); $candidate_rec = $candidate->getRecordVoted(1, $votID1); $pdf->AddPage(); $pdf->SetFont('Times', '', 11); $pdf->MultiCell(0, 2, 'University of Immaculate Conception', 0, 'C'); $pdf->Ln(); $pdf->MultiCell(0, 2, 'Davao City, Philippines 8000', 0, 'C'); $pdf->Ln(); $pdf->MultiCell(0, 2, 'Student Supreme Government Elections', 0, 'C'); $pdf->Ln(); $pdf->MultiCell(0, 3, 'A.Y. 2012 - 2013', 0, 'C'); $pdf->Ln(); $pdf->MultiCell(0, 3, 'OFFICIAL BALLOT', 0, 'C'); $pdf->Ln(); $pdf->Rect(10, 35, 95, 99, 'D'); $pdf->SetFont('Times', '', 12); $pdf->Cell(10, 8, "SSG Executive"); $pdf->Ln(); $z = 0; for ($x = 0; $x < count($position_rec); $x++) { $pdf->SetFont('Times', '', 10); $pdf->Cell(40, 5, $position_rec[$x]['posName']); $ctr = count($candidate_rec); if (!empty($candidate_rec[$x])) { for ($y = 0; $y < count($candidate_rec); $y++) { if ($y < $ctr) { $posId1 = $position_rec[$x]['posID']; $posId2 = $candidate_rec[$y]['id']; if ($posId1 == $posId2) { $pdf->SetFont('Times', 'I', 9);
$pdf->Cell(25, 6, $direccion, 1, 0, 'C', FALSE); $pdf->Cell(25, 6, $fecha_denuncia, 1, 0, 'C', FALSE); $pdf->Cell(40, 6, $id_denuncia, 1, 0, 'C', FALSE); $pdf->Ln(); $pdf->SetXY(20, 50); $pdf->SetFillColor(35, 65, 129); $pdf->SetFont('Arial', '', 8); $pdf->setTextColor(255, 255, 255); $pdf->Cell(70, 6, utf8_decode('APELLIDOS Y NOMBRES DEL EMPLEADOR'), 1, 0, 'C', TRUE); $pdf->setTextColor(0, 0, 0); $pdf->Cell(95, 6, $representante, 1, 0, 'C', FALSE); $pdf->Ln(); $pdf->SetXY(20, 60); $pdf->setTextColor(255, 255, 255); $pdf->Cell(165, 6, utf8_decode('MOTIVO(S) DE LA QUEJA Y/O RECLAMO'), 1, 0, 'C', TRUE); $pdf->Rect(20, 60, 165, 25, 'fill'); $pdf->setTextColor(0, 0, 0); $pdf->SetXY(20, 70); $pdf->SetRightMargin(25.0); $pdf->setTextColor(0, 0, 0); $texto = ""; foreach ($motivos as $key => $motivo) { $texto .= $motivo['DESCRIPCION'] . ", "; } $texto = substr($texto, 0, -2); $pdf->MultiCell(0, 4, utf8_decode($texto)); $pdf->SetRightMargin(25.0); $pdf->SetXY(20, 90); $pdf->setTextColor(0, 0, 0); $pdf->MultiCell(0, 4, utf8_decode('Le notificamos que su Queja y/o Reclamo interpuesta por usted, fue atendidida de acuerdo al proceso intrínseco de verificación, el cual fue realizado por esta Dirección General de Fiscalización de acuerdo a lo establecido en las normas legales vigentes que rigen la materia y del cual se desprende lo siguiente:')); /*
public function drawPDF() { $pdf = new \FPDF('L', 'mm', 'Letter'); $pdf->SetMargins(3.175, 3.175, 3.175); $pdf->SetAutoPageBreak(false); define('FPDF_FONTPATH', dirname(__FILE__) . '/noauto/fonts/'); $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php'); $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php'); $pdf->AddFont('GillBook', '', 'GillSansMTPro-Book.php'); $pdf->SetFont('Gill', '', 16); $data = $this->loadItems(); $count = 0; $sign = 0; $width = 68.67; $height = 71; $top = 22; $left = 6.0; $effective_width = $width - $left; foreach ($data as $item) { if ($count % 12 == 0) { if ($count != 0) { // draw tick marks again // sometimes other content of the page // overwrites them $pdf->Line(2, $height + 0.0, 6, $height + 0.0); $pdf->Line(2, 2 * $height + 1.0, 6, 2 * $height + 1.0); $pdf->Line(4 * $width - 3, $height + 0.0, 4 * $width + 1, $height + 0.0); $pdf->Line(4 * $width - 3, 2 * $height + 1.0, 4 * $width + 1, 2 * $height + 1.0); $pdf->Line($width + 1.5, 2, $width + 1.5, 8); $pdf->Line(2 * $width + 1.5, 2, 2 * $width + 1.5, 8); $pdf->Line(3 * $width + 1.5, 2, 3 * $width + 1.5, 8); $pdf->Line($width + 1.5, 3 * $height - 6, $width + 1.5, 3 * $height); $pdf->Line(2 * $width + 1.5, 3 * $height - 6, 2 * $width + 1.5, 3 * $height); $pdf->Line(3 * $width + 1.5, 3 * $height - 6, 3 * $width + 1.5, 3 * $height); } $pdf->AddPage(); // draw tick marks for cutting $pdf->Line(2, $height + 0.0, 6, $height + 0.0); $pdf->Line(2, 2 * $height + 1.0, 6, 2 * $height + 1.0); $pdf->Line(4 * $width - 3, $height + 0.0, 4 * $width + 1, $height + 0.0); $pdf->Line(4 * $width - 3, 2 * $height + 1.0, 4 * $width + 1, 2 * $height + 1.0); $pdf->Line($width + 1.5, 2, $width + 1.5, 8); $pdf->Line(2 * $width + 1.5, 2, 2 * $width + 1.5, 8); $pdf->Line(3 * $width + 1.5, 2, 3 * $width + 1.5, 8); $pdf->Line($width + 1.5, 3 * $height - 6, $width + 1.5, 3 * $height); $pdf->Line(2 * $width + 1.5, 3 * $height - 6, 2 * $width + 1.5, 3 * $height); $pdf->Line(3 * $width + 1.5, 3 * $height - 6, 3 * $width + 1.5, 3 * $height); $sign = 0; } $row = floor($sign / 4); $column = $sign % 4; $price = $item['normal_price']; if ($item['scale']) { if (substr($price, 0, 1) != '$') { $price = sprintf('$%.2f', $price); } $price .= ' /lb.'; } elseif (isset($item['signMultiplier'])) { $price = $this->formatPrice($item['normal_price'], $item['signMultiplier']); } else { $price = $this->formatPrice($item['normal_price']); } $pdf->Image(dirname(__FILE__) . '/cd_head_16.png', $left - 1 + $width * $column, $top - 19 + $row * $height, $width - 6); $pdf->SetXY($left + $width * $column, $top + $row * $height + 1); $pdf->SetFont('Gill', 'B', $this->SMALL_FONT); $pdf->MultiCell($effective_width, 6, strtoupper($item['brand']), 0, 'C'); /** This block attempts to write the description then checks how many lines it took. If the description was longer than two lines, it whites the whole thing out, drops one font size, and tries again. Calculating effective text size with smart line breaks seems really tough. */ $pdf->SetFont('Gill', '', $this->MED_FONT); $font_shrink = 0; while (true) { $pdf->SetX($left + $width * $column); $y = $pdf->GetY(); $pdf->MultiCell($effective_width, 7, $item['description'], 0, 'C'); if ($pdf->GetY() - $y > 14) { $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $font_shrink++; if ($font_shrink >= $this->MED_FONT) { break; } $pdf->SetFontSize($this->MED_FONT - $font_shrink); $pdf->SetXY($left + $width * $column, $y); } else { if ($pdf->GetY() - $y < 14) { $words = explode(' ', $item['description']); $multi = ''; for ($i = 0; $i < floor(count($words) / 2); $i++) { $multi .= $words[$i] . ' '; } $multi = trim($multi) . "\n"; for ($i = floor(count($words) / 2); $i < count($words); $i++) { $multi .= $words[$i] . ' '; } $item['description'] = trim($multi); $pdf->SetFillColor(0xff, 0xff, 0xff); $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F'); $pdf->SetXY($left + $width * $column, $y); $pdf->MultiCell($effective_width, 7, $item['description'], 0, 'C'); } break; } } $pdf->SetX($left + $width * $column); $pdf->SetFont('GillBook', '', $this->SMALLER_FONT); $item['size'] = strtolower($item['size']); if (substr($item['size'], -1) != '.') { $item['size'] .= '.'; // end abbreviation w/ period $item['size'] = str_replace('fz.', 'fl oz.', $item['size']); } if (substr($item['size'], 0, 1) == '.') { $item['size'] = '0' . $item['size']; // add leading zero on decimal qty } if (strlen(ltrim($item['upc'], '0')) < 5 && $item['scale']) { $item['size'] = 'PLU# ' . ltrim($item['upc'], '0'); // show PLU #s on by-weight } $pdf->Cell($effective_width, 6, $item['size'], 0, 1, 'C'); $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 42)); $pdf->SetFont('Gill', '', $this->BIG_FONT); $pdf->Cell($effective_width, 12, $price, 0, 1, 'C'); if ($item['startDate'] != '' && $item['endDate'] != '') { // intl would be nice $datestr = date('M d', strtotime($item['startDate'])) . chr(0x96) . date('M d', strtotime($item['endDate'])); $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 37)); $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT); $pdf->Cell($effective_width, 20, strtoupper($datestr), 0, 1, 'R'); } if ($item['upc'] != '') { $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 37)); $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT); $pdf->Cell($effective_width, 20, $item['upc'], 0, 1, 'L'); } $pdf->Image(dirname(__FILE__) . '/' . $this->footer_image, $left - 1 + $width * $column, $top + $height * $row + ($height - $top - 4), $width - 6); $count++; $sign++; } $pdf->Output('Signage12UpL.pdf', 'I'); }
function Rect($x, $y, $w, $h, $style = '', $border_style = null, $fill_color = null) { if (!(false === strpos($style, 'F')) && $fill_color) { list($r, $g, $b) = $fill_color; $this->SetFillColor($r, $g, $b); } switch ($style) { case 'F': $border_style = null; parent::Rect($x, $y, $w, $h, $style); break; case 'DF': case 'FD': if (!$border_style || isset($border_style['all'])) { if (isset($border_style['all'])) { $this->SetLineStyle($border_style['all']); $border_style = null; } } else { $style = 'F'; } parent::Rect($x, $y, $w, $h, $style); break; default: if (!$border_style || isset($border_style['all'])) { if (isset($border_style['all']) && $border_style['all']) { $this->SetLineStyle($border_style['all']); $border_style = null; } parent::Rect($x, $y, $w, $h, $style); } break; } if ($border_style) { if (isset($border_style['L']) && $border_style['L']) { $this->Line($x, $y, $x, $y + $h, $border_style['L']); } if (isset($border_style['T']) && $border_style['T']) { $this->Line($x, $y, $x + $w, $y, $border_style['T']); } if (isset($border_style['R']) && $border_style['R']) { $this->Line($x + $w, $y, $x + $w, $y + $h, $border_style['R']); } if (isset($border_style['B']) && $border_style['B']) { $this->Line($x, $y + $h, $x + $w, $y + $h, $border_style['B']); } } }
$pdf = new FPDF(); $image12 = "done2.png"; // Add a page to that object $pdf->AddPage(); $pdf->setleftmargin(10); $pdf->setX(10); $pdf->setY(10); // Add some text $pdf->SetFont('Arial', 'B', 10); $text = "hello"; // width, height, text, no border, next line - below & left margin, alignement // shree rang in centre $pdf->Cell(200, 10, '|| Shree Rang ||', 0, 1, "C"); //create rectangle and registration form $pdf->SetFillColor(0, 0, 0); $pdf->Rect(0, 20, 210, 10, 'F'); $pdf->SetTextColor(255, 255, 255); $pdf->SetFont('Arial', 'B', 15); $pdf->Cell(200, 10, 'REGISTRATION FORM - 2016', 0, 1, "C"); // space below registration form $pdf->Cell(210, 5, '', 0, 1, "C"); //set font and height $pdf->SetFont('Arial', 'B', 12); $pdf->SetTextColor(0, 0, 0); //space before form no. $pdf->Cell(10, 5, '', 0, 0, "C"); $pdf->Cell(5, 5, 'FORM NO.', 0, 0, "C"); //space between rect and form no tag $pdf->Cell(10, 5, '', 0, 0, "C"); // create box for form $pdf->Cell(30, 5, $form, 1, 0, "C");
$fac->Cell(100,0,'Sucursal Saltillo, Coah. Blvd. Venustiano Carranza 3985, '); $fac->setXY(50,25); $fac->Cell(100,0,'Col. Villa Olimpica, C.P. 25230, Tel. +52 (844) 439 0084/0085'); $fac->setXY(50,28); $fac->Cell(100,0,'Sucursal Cd. Victoria, Tamps. 14, Olivia Ramíres 1301, '); $fac->setXY(50,31); $fac->Cell(100,0,'Col. San Francisco C.P. 87040, Tel. +52 (834) 110 1886'); */ $fac->SetFont('Arial', '', 8); if (!empty($factura)) { $res = mysql_query("select *,vta_p_facturas.COMENTARIO AS COMENTARIOS from vta_p_facturas,vta_c_clientes where vta_p_facturas.FACTURA_ID={$factura} and vta_p_facturas.CLIENTE_ID=vta_c_clientes.CLIENTE_ID"); while ($row = mysql_fetch_array($res)) { //NUMERO DE FACTURA $fac->setXY(145, 35); $fac->Cell(20, 0, 'FACTURA NO.'); $fac->Rect(167, 32, 33, 5); $fac->setXY(167, 35); $fac->Cell(33, 0, $row['FACTURA_ID'], 0, 0, 'C'); //FECHA Y HORA $fac->Rect(10, 37, 85, 6); $fac->SetFont('Arial', '', 7); $fac->setXY(10, 40); $fac->Cell(10, 0, 'FECHA: ' . $row['FECHA']); $fac->setXY(40, 40); $fac->Cell(10, 0, 'HORA: ' . date("H:i:s", time())); //DATOS DE CLIENTE $fac->Rect(95, 37, 105, 6); $fac->setXY(100, 40); $fac->Cell(100, 0, $row['RFC']); $fac->SetFont('Arial', '', 8); $fac->Rect(10, 43, 190, 24);
$pdf->Cell(100, 0, utf8_decode('Número de informes: ' . $numeroInformes)); //EL GRUPO CONOCE LAS NORMAS $datoConoceNormas = mysql_query("SELECT * FROM evaluaciongeneral WHERE grupo='{$grupo}' AND conocenormas='No'", $link); $noConoceNormas = mysql_num_rows($datoConoceNormas); $conoceNormas = $numeroInformes - $noConoceNormas; $pdf->SetFont('Arial', 'B', 12); $pdf->Ln(10); $pdf->Cell(0, 0, utf8_decode('El grupo conoce las normas: ')); $pdf->Ln(10); $pdf->SetFont('Arial', '', 12); $textoConoceNormas = "Sí:" . round($conoceNormas / $numeroInformes * 100, 2) . "% (" . $conoceNormas . " respuestas)"; $textoNoConoceNormas = "No: " . round($noConoceNormas / $numeroInformes * 100, 2) . "% (" . $noConoceNormas . " respuestas)"; $pdf->Cell(80, 0, utf8_decode($textoConoceNormas)); $pdf->SetFillColor(0, 255, 0); $pdf->SetDrawColor(0, 0, 0); $pdf->Rect($pdf->GetX(), $pdf->GetY() - 2, $conoceNormas / $numeroInformes * 100, 3, FD); $pdf->Ln(5); $pdf->Cell(80, 0, utf8_decode($textoNoConoceNormas)); $pdf->SetFillColor(255, 0, 0); $pdf->SetDrawColor(0, 0, 0); $pdf->Rect($pdf->GetX(), $pdf->GetY() - 2, $noConoceNormas / $numeroInformes * 100, 3, FD); $pdf->Ln(5); //$pdf->Multicell(160,5, utf8_decode($textoConoceNormas),1,'L',0); $pdf->Ln(5); //EL GRUPO CUMPLE LAS NORMAS $datoCumpleNormas = mysql_query("SELECT * FROM evaluaciongeneral WHERE grupo='{$grupo}' AND respetanormas='No'", $link); $noCumpleNormas = mysql_num_rows($datoCumpleNormas); $cumpleNormas = $numeroInformes - $noCumpleNormas; /* $textoCumpleNormas="El grupo cumple las normas: "."\n Sí:".(($cumpleNormas/$numeroInformes)*100)."% (".$cumpleNormas." respuestas)"."\n"."No: ".(($noCumpleNormas/$numeroInformes)*100)."% (".$noCumpleNormas." respuestas)"; //$pdf->SETXY(10,45);
$pdf->setTextColor(255, 255, 255); $pdf->Cell(50, 6, utf8_decode('N° DE QUEJAS Y/O RECLAMOS'), 1, 0, 'C', TRUE); $pdf->SetXY(20, 32); $pdf->Cell(50, 6, '', 1, 0, 'C', FALSE); $pdf->setTextColor(0, 0, 0); $pdf->SetFont('Arial', 'B', 8); $pdf->Text(60, 50, utf8_decode('COMPROBANTE DE RECEPCIÓN DE QUEJA Y/O RECLAMO')); $pdf->SetXY(20, 52); $pdf->SetFont('Arial', 'B', 8); $pdf->setTextColor(255, 255, 255); $pdf->Cell(50, 6, utf8_decode('FECHA DE PRESENTACIÓN'), 1, 0, 'C', TRUE); $pdf->Cell(35, 6, '', 1, 0, 'C', FALSE); $pdf->Cell(50, 6, utf8_decode('HORA DE PRESENTACIÓN'), 1, 0, 'C', TRUE); $pdf->Cell(35, 6, '', 1, 0, 'C', FALSE); $pdf->setTextColor(255, 255, 255); $pdf->Rect(20, 60, 110, 30, 'FD'); $pdf->Rect(20, 90, 110, 30, 'FILL'); $pdf->Rect(20, 120, 110, 30, 'FILL'); $pdf->Rect(130, 60, 60, 90, 'FILL'); $pdf->Text(55, 75, utf8_decode('FUNCIONARIO(A) RECEPTOR')); $pdf->setTextColor(0, 0, 0); $pdf->SetFont('Arial', '', 8); $pdf->Text(23, 105, utf8_decode('APELLIDOS Y NOMBRES:')); $pdf->SetFont('Arial', 'B', 8); $pdf->Text(70, 148, utf8_decode('FIRMA')); $pdf->Text(155, 105, utf8_decode('SELLO')); $pdf->Rect(20, 152, 170, 30, 'FILL'); $pdf->Text(22, 158, utf8_decode('NOTA IMPORTANTE:')); $pdf->SetXY(22, 160); $pdf->SetFont('Arial', '', 8); $pdf->SetRightMargin(20.0);
$pdf->setX(20); $pdf->setY(10); $pdf->SetFillColor(0, 0, 0); $pdf->Cell(190, 140, '', 1, 0, "C"); $pdf->setX(20); $pdf->setY(15); $pdf->SetFillColor(0, 0, 0); $image1 = 'logo.png'; // Add some text $pdf->SetFont('Arial', '', 20); // width, height, text, no border, next line - below & left margin, alignement // shree rang in centre $pdf->Cell(175, 10, ' Explora Academy of Design', 0, 0, "C"); $pdf->Cell(15, 10, $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 10), 0, 1, 'R', false); $pdf->SetFillColor(0, 0, 0); $pdf->Rect(20, 26, 175, 1, 'F'); $pdf->Cell(10, 8, '', 0, 1, "C"); //set font and height $pdf->SetFont('Arial', '', 12); $pdf->SetTextColor(0, 0, 0); //space before form no. $pdf->Cell(20, 10, '', 0, 0, "C"); $pdf->Cell(20, 7, 'RECEIPT NUMBER:', 0, 0, "C"); //space between rect and form no tag $pdf->Cell(15, 10, '', 0, 0, "C"); // create box for form $pdf->Cell(30, 7, $form, 1, 0, "C"); //space after box $pdf->Cell(30, 10, '', 0, 0, "C"); $pdf->Cell(15, 7, 'DATE:', 0, 0, "C"); //display date
function index_print() { global $root, $srcdir, $tmpdir; include_once $srcdir . DS . 'libs' . DS . 'fpdf.php'; include_once $srcdir . DS . 'libs' . DS . 'barcode.php'; if (!isset($_POST['mandate'])) { $_POST['mandate'] = 1; } if (!isset($_POST['subscription'])) { $_POST['subscription'] = 1; } $mdt = new Modele('mandate'); $mdt->fetch($_POST['mandate']); $sub = new Modele('subscription'); $sub->fetch($_POST['subscription']); $usr = new Modele('users'); $usr->fetch($_SESSION['user']['user_id']); $sublist = new Modele('subscription'); //$sublist->find(array('subscription_mandate' => $mdt->mandate_id)); $sublist->find(); if (new DateTime($mdt->mandate_start) > new DateTime() || new DateTime($mdt->mandate_end) < new DateTime()) { modexec('syscore', 'moderror'); } ob_start(); $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetXY(18, 12); $pdf->SetFont('Arial', '', 30); $pdf->Cell(180, 10, 'EPITANIME', 0, 0, 'C'); $pdf->SetFont('Arial', '', 10); $pdf->SetXY(18, 21); $pdf->Cell(180, 5, 'FEUILLE DE RENSEIGNEMENTS ' . uc($mdt->mandate_label), 0, 0, 'C'); $pdf->SetXY(18, 26); $pdf->Cell(180, 5, 'Veuillez remplir lisiblement en lettres capitales', 0, 0, 'C'); $pdf->SetFont('Arial', 'B', 10); $pdf->SetXY(18, 35); $pdf->Cell(180, 5, 'Informations essentielles :', 0, 0, ''); $pdf->SetXY(18, 40); $pdf->Cell(50, 5, 'Pseudo', 1, 0, ''); $pdf->SetXY(18, 45); $pdf->Cell(50, 5, 'Nom', 1, 0, ''); $pdf->SetXY(18, 50); $pdf->Cell(50, 5, uc('Prénom'), 1, 0, ''); $pdf->SetXY(18, 55); $pdf->Cell(50, 5, 'Adresse', 1, 0, ''); $pdf->SetXY(18, 60); $pdf->Cell(50, 5, 'Code postal', 1, 0, ''); $pdf->SetXY(18, 65); $pdf->Cell(50, 5, 'Ville', 1, 0, ''); $pdf->SetXY(18, 70); $pdf->Cell(50, 5, 'Sexe', 1, 0, ''); $pdf->SetXY(18, 75); $pdf->Cell(50, 5, 'Date de naissance', 1, 0, ''); $pdf->SetXY(18, 80); $pdf->Cell(50, 5, uc('Téléphone'), 1, 0, ''); $pdf->SetXY(18, 85); $pdf->Cell(50, 5, 'Courriel', 1, 0, ''); $pdf->SetXY(18, 95); $pdf->Cell(50, 5, uc('Réservé aux étudiants IONIS'), 0, 0, ''); $pdf->SetXY(18, 100); $pdf->Cell(50, 5, 'Login', 1, 0, ''); $pdf->SetXY(18, 105); $pdf->Cell(50, 5, 'Ecole', 1, 0, ''); $pdf->SetXY(18, 110); $pdf->Cell(50, 5, 'Promotion', 1, 0, ''); $pdf->SetXY(18, 120); $pdf->Cell(50, 5, uc('Réservé aux membres prenant l\'inscription FFG (fédération française de GO)'), 0, 0, ''); $pdf->SetXY(18, 125); $pdf->Cell(50, 5, uc('Nationalité'), 1, 0, ''); $pdf->SetXY(18, 130); $pdf->Cell(50, 5, 'Niveau', 1, 0, ''); $pdf->SetXY(18, 135); $pdf->Cell(50, 5, 'Pseudo FFG', 1, 0, ''); $pdf->SetFont('Arial', '', 12); $pdf->SetXY(18, 222); $pdf->Cell(160, 5, uc('Reçu par ______________________ le ___/___/20___ , accompagné de la cotisation choisie.'), 0, 0, ''); $pdf->SetFont('Arial', 'B', 10); $pdf->SetXY(38, 230); $pdf->Cell(50, 5, 'Signature du membre', 1, 0, ''); $pdf->Rect(38, 235, 50, 20); $pdf->SetXY(130, 230); $pdf->Cell(50, 5, uc('Signature du récepteur'), 1, 0, ''); $pdf->Rect(130, 235, 50, 20); $pdf->SetFont('Arial', '', 8); $pdf->SetXY(18, 260); $pdf->MultiCell(180, 3, uc('Les informations recueillies sont nécessaires pour votre adhésion. Elles font l’objet d’un traitement informatique et sont destinées au secrétariat de l’association. En application de l’article 34 de la loi du 6 janvier 1978, vous bénéficiez d’un droit d’accès et de rectification aux informations qui vous concernent. Si vous souhaitez exercer ce droit et obtenir communication des informations vous concernant, veuillez vous adresser au secrétariat de l’association.')); $pdf->SetFont('Arial', '', 10); $pdf->SetXY(68, 40); $pdf->Cell(130, 5, uc($usr->user_name), 1, 0, ''); $pdf->SetXY(68, 45); $pdf->Cell(130, 5, uc($usr->user_lastname), 1, 0, ''); $pdf->SetXY(68, 50); $pdf->Cell(130, 5, uc($usr->user_firstname), 1, 0, ''); $pdf->SetXY(68, 55); $pdf->Cell(130, 5, uc($usr->user_address), 1, 0, ''); $pdf->SetXY(68, 60); $pdf->Cell(130, 5, uc($usr->user_cp), 1, 0, ''); $pdf->SetXY(68, 65); $pdf->Cell(130, 5, uc($usr->user_town), 1, 0, ''); $pdf->SetXY(68, 70); $pdf->Cell(130, 5, uc($usr->user_sexe), 1, 0, ''); $pdf->SetXY(68, 75); $pdf->Cell(130, 5, uc($usr->user_born), 1, 0, ''); $pdf->SetXY(68, 80); $pdf->Cell(130, 5, uc($usr->user_phone), 1, 0, ''); $pdf->SetXY(68, 85); $pdf->Cell(130, 5, uc($usr->user_email), 1, 0, ''); $pdf->SetXY(68, 100); $pdf->Cell(130, 5, uc($usr->user_login), 1, 0, ''); $pdf->SetXY(68, 105); $pdf->Cell(130, 5, uc($usr->user_type->ut_name), 1, 0, ''); $pdf->SetXY(68, 110); $pdf->Cell(130, 5, uc($usr->user_promo), 1, 0, ''); $pdf->SetXY(68, 125); $pdf->Cell(130, 5, '', 1, 0, ''); $pdf->SetXY(68, 130); $pdf->Cell(130, 5, '', 1, 0, ''); $pdf->SetXY(68, 135); $pdf->Cell(130, 5, '', 1, 0, ''); $pdf->SetFont('Arial', 'B', 10); $pdf->SetXY(18, 145); $pdf->Cell(50, 5, uc('Cotisation'), 0, 0, ''); $cb = '9' . str_pad($mdt->getKey(), 4, '0', STR_PAD_LEFT) . str_pad($usr->getKey(), 7, '0', STR_PAD_LEFT); $cbfile = tempnam($tmpdir, 'cb'); imagebarcode($cbfile, $cb, 200, 40, 2); $pdf->Image($cbfile, 10, 10, 30, 0, 'PNG'); unlink($cbfile); $pdf->SetFont('Arial', 'I', 8); $pdf->SetXY(185, 10); $pdf->Cell(10, 5, $usr->getKey(), 0, 0, 'R'); $pos = -1; $pdf->SetFont('Arial', '', 10); while ($c = $sublist->next()) { $pos++; $x = 25 + $pos % 2 * 90; $y = 150 + 5 * floor($pos / 2); $pdf->SetXY($x, $y); $pdf->Cell(60, 5, uc($c['subscription_label']), 1, 0, ''); $pdf->Cell(15, 5, number_format($c['subscription_price'], 2, ',', '') . ' ' . chr(128), 1, 0, ''); $pdf->Rect($x + 75, $y, 5, 5); if ($c['subscription_id'] == $sub->subscription_id) { $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(5, 5, 'X', 0, 0, 'C'); $pdf->SetFont('Arial', '', 10); } } if (ob_get_flush() == '') { $pdf->Output('inscription.pdf', 'I'); } quit(); }
function PrintChecks() { //////////////////////////// // label-specific variables $page_width = 8.5; $page_height = 11; $top_margin = 0; $left_margin = 2.5; $columns = 1; $gutter = 3 / 16; $rows = 3; // only used for making page breaks, no position calculations $label_height = 2.85; $label_width = 6; // cell margins $cell_left = 0.25; $cell_top = 0.25; $cell_bot = 0.25; // //////////////////////////// $img_ratio = 1.4; // loqisaur $img_ratio = 0.47; // cyan $img_ratio = 1.71; // marvelous labs $logo_width = 0.66; // loqisaur $logo_width = 0.2; // cyan $logo_width = 0.5; // marvelous labs $pdf = new FPDF('P', 'in', array($page_width, $page_height)); $pdf->AddFont('Twcen', '', 'twcen.php'); $pdf->AddFont('Micr', '', 'micr.php'); $pdf->AddFont('Courier', '', 'courier.php'); $pdf->SetMargins($left_margin, $top_margin); $pdf->SetDisplayMode("fullpage", "continuous"); $pdf->AddPage(); $lpos = 0; foreach ($this->checks as $check) { $pos = $lpos % ($rows * $columns); // calculate coordinates of top-left corner of current cell // margin cell offset $x = $left_margin + $pos % $columns * ($label_width + $gutter); // margin cell offset $y = $top_margin + floor($pos / $columns) * $label_height; ///////////////// // set up check template $pdf->SetFont('Twcen', '', 11); // print check number $pdf->SetXY($x + 5.25, $y + 0.33); $pdf->Cell(1, 11 / 72, $check['check_number'], 0, 'R'); $logo_offset = 0; // offset to print name if logo is inserted if (array_key_exists('logo', $check) && $check['logo'] != "") { // logo should be: 0.71" x 0.29" $logo_offset = $logo_width + 0.005; // width of logo $pdf->Image($check['logo'], $x + $cell_left, $y + $cell_top + 0.12, $logo_width); } $pdf->SetFont('Twcen', '', 7); // name $pdf->SetXY($x + $cell_left + $logo_offset, $y + $cell_top + 0.1); $pdf->SetFont('Twcen', '', 10); $pdf->Cell(2, 10 / 72, $check['from_name'], 0, 2); $pdf->SetFont('Twcen', '', 7); $pdf->Cell(2, 7 / 72, $check['from_address1'], 0, 2); $pdf->Cell(2, 7 / 72, $check['from_address2'], 0, 2); // date $pdf->Line($x + 3.5, $y + 0.58, $x + 3.5 + 1.2, $y + 0.58); $pdf->SetXY($x + 3.5, $y + 0.48); $date_str = $this->matchcase($check['from_name'], "date"); $pdf->Cell(1, 7 / 72, $date_str); // pay to the order of $pdf->Line($x + $cell_left, $y + 1.1, $x + $cell_left + 4.1, $y + 1.1); $pdf->SetXY($x + $cell_left, $y + 0.88); $pay_str = $this->matchcase($check['from_name'], "pay to the order of"); $pdf->MultiCell(0.6, 7 / 72, $pay_str, '', '', 'L'); // amount box $pdf->Rect($x + 4.5, $y + 0.83, 1.1, 0.25); // dollars $pdf->Line($x + $cell_left, $y + 1.5, $x + $cell_left + 5.37, $y + 1.5); $pdf->SetXY($x + $cell_left + 4.37, $y + 1.4); $dollar_str = $this->matchcase($check['from_name'], "dollars"); $pdf->Cell(1, 7 / 72, $dollar_str, '', '', 'R'); // bank info $pdf->SetXY($x + $cell_left, $y + 1.6); $pdf->Cell(2, 7 / 72, $check['bank_1'], 0, 2); $pdf->Cell(2, 7 / 72, $check['bank_2'], 0, 2); $pdf->Cell(2, 7 / 72, $check['bank_3'], 0, 2); $pdf->Cell(2, 7 / 72, $check['bank_4'], 0, 2); // memo $pdf->Line($x + $cell_left, $y + 2.225, $x + $cell_left + 2.9, $y + 2.225); $pdf->SetXY($x + $cell_left, $y + 2.125); $memo_str = $this->matchcase($check['from_name'], "memo"); $pdf->Cell(1, 7 / 72, $memo_str); // signature line $pdf->Line($x + 3.25, $y + 2.225, $x + 3.25 + 2.375, $y + 2.225); //////////////////////// // fill in values for this check $pdf->SetFont('Courier', '', 11); // date if ($check['date'] != "") { $pdf->SetXY($x + 3.5 + 0.3, $y + 0.38); $pdf->Cell(1, 0.25, $check['date']); } // pay to if ($check['pay_to'] != "") { $pdf->SetXY($x + $cell_left + 0.5, $y + 0.88); $pdf->Cell(1, 0.25, $check['pay_to']); } // amount if ($check['amount'] > 0) { $dollars = intval($check['amount']); $cents = round(($check['amount'] - $dollars) * 100); //$dollars_str = TextualNumber::GetText($dollars); $numtxt = new TextualNumber($dollars); $dollars_str = $numtxt->numToWords($dollars); $amt_string = "***" . ucfirst(strtolower($dollars_str)) . " dollars"; if ($cents > 0) { $amt_string .= " and " . $cents . "/100"; } else { $amt_string .= " and 00/100"; } $amt_string .= "***"; $pdf->SetFont('Courier', '', 9); $pdf->SetXY($x + $cell_left, $y + 1.28); $pdf->Cell(1, 0.25, $amt_string); #$amt = '$'.sprintf("%01.2f",$check['amount']); $amt = '$' . number_format($check['amount'], 2); $pdf->SetXY($x + 4.5 + 0.06, $y + 0.83); $pdf->Cell(1, 0.25, $amt); } // memo $pdf->SetFont('Courier', '', 8); $pdf->SetXY($x + $cell_left + 0.3, $y + 2.02); $pdf->Cell(1, 0.25, $check['memo']); $pdf->SetFont('Courier', '', 11); // routing and account number $pdf->SetFont('Micr', '', 10); $routingstring = "t" . $check['routing_number'] . "t" . $check['account_number'] . "o" . $check['check_number']; if (array_key_exists('codeline', $check)) { $routingstring = $check['codeline']; } $pdf->SetXY($x + $cell_left, $y + 2.47); $pdf->Cell(5, 10 / 72, $routingstring); // signature if (substr($check['signature'], -3) == 'png') { $sig_offset = 1.75; // width of signature $pdf->Image($check['signature'], $x + $cell_left + 3.4, $y + 1.88, $sig_offset); } else { $pdf->SetFont('Arial', 'i', 10); if ($check['signature'] != "") { $pdf->SetXY($x + $cell_left + 3.4, $y + 2.01); $pdf->Cell(1, 0.25, $check['signature']); } } // pre-authorized disclaimer $pdf->SetFont('Arial', '', 6); if (isset($check['pre_auth'])) { $pdf->SetXY($x + $cell_left + 3.3, $y + 2.155); $pdf->Cell(1, 0.25, "This check is pre-authorized by your depositor"); } if ($pos == $rows * $columns - 1 && !($lpos == count($this->checks) - 1)) { $pdf->AddPage(); } $lpos++; } $pdf->Output(); }
public function post_id_upc_terms_handler() { $this->id = preg_split('/[^\\d]/', $this->id, 0, PREG_SPLIT_NO_EMPTY); $pdf = new FPDF('P', 'mm', 'Letter'); $pdf->SetMargins(6.35, 6.35, 6.35); // quarter-inch margins $pdf->SetAutoPageBreak(false); $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php'); $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php'); $margins = $pdf->GetMargins(); $margins['top'] = 0.0; $check_left_x = $margins['left'] > 3.175 ? $margins['right'] : 3.175 - $margins['left']; $real_check_top_y = 183.675 - $margins['top']; $check_right_x = 203.2 - $margins['left']; $real_check_bottom_y = 255.112 - $margins['top']; $line_height = 5; $envelope_window_tab = 15; $right_col1 = 130; $right_col2 = 170; $my_address = array('610 E 4th St', 'Duluth, MN 55805', 'Tel: 218.728.0884', 'www.wholefoods.coop'); $check_date = date('F j, Y'); $dbc = $this->connection; $dbc->setDefaultDB($this->config->get('OP_DB')); $signage = new COREPOS\Fannie\API\item\FannieSignage(array()); foreach ($this->id as $card_no) { $pdf->AddPage(); $account = \COREPOS\Fannie\API\member\MemberREST::get($card_no); $primary = array(); foreach ($account['customers'] as $c) { if ($c['accountHolder']) { $primary = $c; break; } } $check_number = rand(100000, 999995); for ($i = 0; $i < 3; $i++) { $pdf->SetFont('Gill', '', 10); $check_top_y = $real_check_top_y - $i * 90; $check_bottom_y = $real_check_bottom_y - $i * 90; $pdf->SetXY($check_left_x, $check_top_y); $pdf->Ln($line_height * 4.25); foreach ($my_address as $line) { $pdf->SetX($check_left_x + $envelope_window_tab + 20); if ($line == 'www.wholefoods.coop') { $pdf->SetFont('Gill', 'B', 9); } $pdf->Cell(0, $line_height, $line, 0, 1); } $pdf->SetFont('Gill', 'B', 10); $pdf->SetXY($check_left_x + $right_col1, $check_top_y); $pdf->Cell(30, $line_height, 'Check Number:', 0, 0, 'R'); $pdf->SetFont('Gill', '', 10); $pdf->SetTextColor(0xff, 0x58, 0); $pdf->SetX($check_left_x + $right_col2); $pdf->Cell(30, $line_height, $check_number, 0, 0, 'R'); $pdf->SetFont('Gill', 'B', 10); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY($check_left_x + $right_col1, $check_top_y + 1.5 * $line_height); $pdf->Cell(30, $line_height, 'Date:', 0, 0, 'R'); $pdf->SetFont('Gill', '', 10); $pdf->SetTextColor(0xff, 0x58, 0); $pdf->SetX($check_left_x + $right_col2); $pdf->Cell(30, $line_height, $check_date, 0, 0, 'R'); $pdf->SetXY($check_left_x + $right_col1, $check_top_y + 3 * $line_height); $pdf->SetFont('Gill', 'B', 10); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(30, $line_height, 'Amount:', 0, 0, 'R'); $pdf->SetXY($check_left_x + $right_col1 + 30, $check_top_y + 3 * $line_height); $pdf->SetFont('Gill', '', 10); $pdf->SetTextColor(0xff, 0x58, 0); $pdf->MultiCell(40, $line_height, str_repeat(' ', 2) . $this->terms, 0, 'R'); $pdf->SetTextColor(0, 0, 0); $their_address = array($primary['firstName'] . ' ' . $primary['lastName']); $their_address[] = $account['addressFirstLine']; if ($account['addressSecondLine']) { $their_address[] = $account['addressSecondLine']; } $their_address[] = $account['city'] . ', ' . $account['state'] . ' ' . $account['zip']; $pdf->SetXY($check_left_x + $envelope_window_tab, $check_top_y + 11 * $line_height); $pdf->SetFont('Gill', 'B', 10); foreach ($their_address as $line) { $pdf->SetX($check_left_x + $envelope_window_tab); $pdf->Cell(0, $line_height, $line, 0, 1); } $pdf->SetFont('Gill', '', 10); $pdf->SetXY($check_left_x, $check_bottom_y + $line_height - 1); $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('Gill', 'B', 10); $pdf->Cell(0, $line_height, 'Redeemable only at Whole Foods Co-op', 0, 0, 'C'); $pdf->SetFont('Gill', '', 10); $pdf->SetXY($check_left_x + 145, $check_top_y + 6 * $line_height + 1); $pdf->SetFont('Gill', '', 8); $pdf->MultiCell(50, $line_height - 2, 'Limit one per day. Cannot be applied to previous purchases. No cash value.'); $pdf->SetFont('Gill', '', 10); $pdf->SetFillColor(0xcc, 0xcc, 0xcc); $pdf->Rect($check_left_x + 84, $check_top_y + 28, 39, 15, 'F'); $pdf->SetFillColor(0, 0, 0); $signage->drawBarcode(ltrim($this->upc, '0'), $pdf, $check_left_x + 87, $check_top_y + 30, array('height' => 11, 'fontsize' => 0)); $pdf->Image('logo.rgb.noalpha.png', $check_left_x + $envelope_window_tab, $check_top_y + 20, 20); $pdf->SetFont('Gill', 'B', '31'); $pdf->SetXY($check_left_x + $envelope_window_tab, $check_top_y + 0.5 * $line_height); $pdf->SetTextColor(0xff, 0x58, 0); $pdf->Cell(0, 3 * $line_height, 'We Appreciate You!'); $pdf->SetFont('Gill', '', '10'); $pdf->SetTextColor(0, 0, 0); $pdf->Image(dirname(__FILE__) . '/../GiveUsMoneyPlugin/img/sig.png', $check_right_x - 63.5, $check_top_y + 9 * $line_height, 63.5); $pdf->SetXY($check_right_x - 63.5, $check_top_y + 12 * $line_height); $pdf->Cell(63.5, $line_height, 'Authorized By Signature', 'T'); $check_number++; } } $pdf->Output(); }