コード例 #1
0
ファイル: class_pdf.php プロジェクト: eistr2n/lansuite
 /**
  * Objekte auf PDF zeichnen
  *
  * @param array $templ
  * @param array $data
  */
 function _write_object($templ, $data)
 {
     global $barcode;
     for ($i = 0; $i < count($templ); $i++) {
         if ($templ[$i]['user_type'] == $row['type'] || $templ[$i]['user_type'] == "0") {
             switch ($templ[$i]['type']) {
                 case 'text':
                     $this->pdf->SetFont($templ[$i]['font'], '', $templ[$i]["fontsize"]);
                     $this->pdf->SetTextColor($templ[$i]["red"], $templ[$i]["green"], $templ[$i]["blue"]);
                     if ($templ[$i]['end_x'] == "1") {
                         $this->pdf->Text($templ[$i]["pos_x"] - $this->pdf->GetStringWidth($templ[$i]['text']) + $this->x, $templ[$i]["pos_y"] + $this->y, $templ[$i]['text']);
                     } else {
                         $this->pdf->Text($templ[$i]["pos_x"] + $this->x, $templ[$i]["pos_y"] + $this->y, $templ[$i]['text']);
                     }
                     break;
                 case 'rect':
                     $this->pdf->SetDrawColor($templ[$i]["red"], $templ[$i]["green"], $templ[$i]["blue"]);
                     if ($templ[$i]['fontsize'] == "1") {
                         $this->pdf->SetFillColor($templ[$i]["red"], $templ[$i]["green"], $templ[$i]["blue"]);
                         $this->pdf->Rect($templ[$i]['pos_x'] + $this->x, $templ[$i]['pos_y'] + $this->y, $templ[$i]['end_x'], $templ[$i]['end_y'], "FD");
                     } else {
                         $this->pdf->SetFillColor(255);
                         $this->pdf->Rect($templ[$i]['pos_x'] + $this->x, $templ[$i]['pos_y'] + $this->y, $templ[$i]['end_x'], $templ[$i]['end_y']);
                     }
                     break;
                 case 'line':
                     $this->pdf->SetDrawColor($templ[$i]["red"], $templ[$i]["green"], $templ[$i]["blue"]);
                     $this->pdf->Line($templ[$i]['pos_x'] + $this->x, $templ[$i]['pos_y'] + $this->y, $templ[$i]['end_x'] + $this->x, $templ[$i]['end_y'] + $this->y);
                     break;
                 case 'image':
                     $this->pdf->Image(IMAGE_PATH . $templ[$i]['text'], $templ[$i]['pos_x'] + $this->x, $templ[$i]['pos_y'] + $this->y, $templ[$i]['end_x'], $templ[$i]['end_y']);
                     break;
                 case 'barcode':
                     $imagename = mt_rand(100000, 999999);
                     $barcode->get_image($data['userid'], BARCODE_PATH . $imagename);
                     $this->pdf->Image(BARCODE_PATH . $imagename . ".png", $templ[$i]['pos_x'] + $this->x, $templ[$i]['pos_y'] + $this->y);
                     $barcode->kill_image(BARCODE_PATH . $imagename);
                 case 'data':
                     $this->pdf->SetFont($templ[$i]['font'], '', $templ[$i]["fontsize"]);
                     $this->pdf->SetTextColor($templ[$i]["red"], $templ[$i]["green"], $templ[$i]["blue"]);
                     if ($templ[$i]['end_x'] == "1") {
                         $this->pdf->Text($templ[$i]["pos_x"] - $this->pdf->GetStringWidth($data[$templ[$i]['text']]) + $this->x, $templ[$i]["pos_y"] + $this->y, $data[$templ[$i]['text']]);
                     } else {
                         $this->pdf->Text($templ[$i]["pos_x"] + $this->x, $templ[$i]["pos_y"] + $this->y, $data[$templ[$i]['text']]);
                     }
                     break;
             }
         }
     }
 }
コード例 #2
0
ファイル: fpdfTpl.php プロジェクト: richardfullmer/fpdf
 /**
  * See FPDF-Documentation ;-)
  */
 function Image($file,$x,$y,$w=0,$h=0,$type='',$link='') {
     parent::Image($file,$x,$y,$w,$h,$type,$link);
     if ($this->intpl) {
         $this->res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
     } else {
         $this->res['page'][$this->page]['images'][$file] =& $this->images[$file];
     }
 }
コード例 #3
0
    $cos = "\$" . number_format($myrow['precioVenta'], 2);
    $pdf->Ln(1);
    //salto de linea
    $pdf->SetX('22');
    $pdf->Cell(0, 0, trim($myrow3['descripcion']), 0, 0, L);
    $pdf->SetX('170');
    $pdf->Cell(0, 0, $myrow['cantidad'], 0, 0, M);
    $pdf->SetX('140');
    $pdf->Cell(0, 0, $cos, 0, 0, R);
    $pdf->Ln(2);
    //salto de linea
    //$pdf->Ln(1); //salto de linea
}
//function Header() {
$image = new fpdf();
$image->Image(CONSTANT_PATH_SIMA . '/imagenes/logohlc.jpg');
//}
//function Footer() {
//$this->Image('/sima/imagenes/logohlc.jpg');
//}
$TOTAL = number_format($SUBTOTAL[0] + $iva, 2);
$centavos = strstr($TOTAL, '.');
$centavos = substr($centavos, '1');
$resultado = numerotexto($TOTAL);
$totalCaracteres = strlen($centavos);
if ($totalCaracteres == '1') {
    $centavos = $centavos . '0';
}
if (!$centavos) {
    $centavos = '00';
}
コード例 #4
0
ファイル: pdf.php プロジェクト: elliotjr/resumeBuilder
<?php

session_start();
// User Inputs
$name = $_POST['firstname'] . " " . $_POST['lastname'];
$email = $_POST['email'];
require "fpdf/fpdf.php";
//$pdf = new fpdf();
$pdf = new fpdf('P', 'mm', 'A4');
$pdf->SetMargins(5, 0, 0);
$pdf->AddPage();
//$pdf->cMargin = 0;
$pdf->Image('template/template.png', '', '', '210', '297', 'PNG');
$pdf->SetFont("Arial", "", "60");
$pdf->Cell(0, 40, $name, 1, 1, "L");
/*
  $pdf->SetFont("Arial", "U", "22");
  $pdf->Cell(0, 10, $name, 1, 1, "C");

  $pdf->SetFont("Arial", "I", "14");
  $pdf->Cell(0, 10, $email, 1, 1, "C");

  $pdf->SetFont("Arial", "I", "14");
  $pdf->Cell(0, 10, 'test', 1, 1, "C");*/
$pdf->Output();