コード例 #1
0
ファイル: SvgToPdf.php プロジェクト: rohmad-st/fpdf
 function construct($svg, $data = array())
 {
     $t = new XML_SvgToPDF();
     $x = new XML_Tree_Morph($svg, array('debug' => 0, 'filter' => array('svg' => array(&$t, 'buildObject'), 'text' => array(&$t, 'buildObject'), 'tspan' => array(&$t, 'buildObject'), 'rect' => array(&$t, 'buildObject'), 'g' => array(&$t, 'buildObject'), 'path' => array(&$t, 'buildObject'), 'sodipodi:namedview' => array(&$t, 'buildNull'), 'defs' => array(&$t, 'buildNull'))));
     $tree = $x->getTreeFromFile();
     $tree = $t->buildobject($tree);
     $orientation = $tree->width > $tree->height ? 'L' : 'P';
     $pdf = new FPDF($orientation, 'mm', 'A4');
     $pdf->open();
     $pdf->setAutoPageBreak(false);
     $pdf->AliasNbPages();
     // convert data to array.
     if (is_object($data)) {
         $data = (array) $data;
     }
     // no data page..
     if (empty($data)) {
         $pdf->addPage();
         $tree->writePDF($pdf, $data);
         $t->debug($tree);
         return $pdf;
     }
     // work out how many pages...
     list($var, $perpage) = $tree->calcPerPage();
     if ($var == '') {
         die('No dynamic group found');
     }
     if (!isset($data[$var])) {
         die('Incorrect dynamic group name');
     }
     $alldata = $data[$var];
     $page = 0;
     while (count($alldata)) {
         $page++;
         $t->debug("<B>PAGE {$page}<B>");
         $page_data = array_splice($alldata, 0, $perpage);
         $data[$var] = $page_data;
         $pdf->addPage();
         $tree->writePDF($pdf, $data);
     }
     $t->debug($tree);
     return $pdf;
 }
コード例 #2
0
ファイル: tags.php プロジェクト: booko/pasteque-server
    Define("COL_SIZE", 22);
    Define("ROW_SIZE", 16);
    Define("COL_NUM", 9);
    Define("ROW_NUM", 17);
    Define("V_PADDING", 0);
    Define("H_PADDING", 0);
    Define("BARCODE_WIDTH", 20);
    Define("BARCODE_HEIGHT", 10);
    Define("TEXT_HEIGHT", 3);
    Define("TEXT_SIZE", 8);
}
require_once \Pasteque\PT::$ABSPATH . "/lib/barcode-master/php-barcode.php";
$font = "./lib/barcode-master/NOTTB___.TTF";
$pdf = new \FPDF(PAPER_ORIENTATION, "mm", PAPER_SIZE);
$pdf->setMargins(H_MARGIN, V_MARGIN);
$pdf->setAutoPageBreak(false, V_MARGIN);
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', TEXT_SIZE);
function pdf_barcode($pdf, $productId, $col, $row)
{
    $product = \Pasteque\ProductsService::get($productId);
    $x = H_MARGIN + $col * COL_SIZE + $col * H_PADDING;
    $y = V_MARGIN + $row * ROW_SIZE + $row * V_PADDING;
    $pdf->SetXY($x, $y);
    $pdf->Cell(BARCODE_WIDTH, TEXT_HEIGHT, utf8_decode($product->reference), 0, 1, "C");
    $pdf->SetXY($x, $y + TEXT_HEIGHT);
    $data = \Barcode::fpdf($pdf, "000000", $pdf->GetX() + BARCODE_WIDTH / 2, $pdf->GetY() + BARCODE_HEIGHT / 2, 0, "ean13", array('code' => $product->barcode), BARCODE_WIDTH / (15 * 7), BARCODE_HEIGHT);
    $pdf->SetXY($x, $y + BARCODE_HEIGHT + TEXT_HEIGHT);
    $pdf->Cell(BARCODE_WIDTH, TEXT_HEIGHT, $product->barcode, 0, 1, "C");
}
$col = 0;
コード例 #3
0
ファイル: cetak.php プロジェクト: aldhikurniawan/testIQ
        } else {
            if ($res[0]['skor'] <= 129 && $res[0]['skor'] >= 115) {
                $tingkat = 'Tinggi dalam kategori normal';
            } else {
                if ($res[0]['skor'] <= 139 && $res[0]['skor'] >= 130) {
                    $tingkat = 'Superior';
                } else {
                    $tingkat = 'Jenius';
                }
            }
        }
    }
}
if ($res[0]['id'] != $user) {
    echo '<script>document.location="index.php"</script>';
}
$pdf = new FPDF('L', 'cm', 'A4');
$pdf->Open();
$pdf->addPage();
$pdf->setAutoPageBreak(false);
$pdf->setFont('Times', '', 17);
$pdf->Image('sertifikatku.jpg', 0, 0, 29.7, 21);
$pdf->Text(20.5, 5.84, '' . $kategori . '');
$pdf->setFont('Times', 'B', 20);
$pdf->text(14.2, 12, '' . $res[0]['skor'] . '', 'C');
$pdf->Cell(0, 25.5, '' . $tingkat . '', 0, 0, 'C', 0, 0);
$pdf->setFont('Times', 'B', 36);
$pdf->Cell(-28, 15.4, '' . $nama . '', 0, 0, 'C', 0, 0);
$pdf->setFont('Times', 'B', 14);
$pdf->text(7.58, 2.818, '' . $tgl . '/' . $nomor . '', 'C');
$pdf->output();
コード例 #4
0
ファイル: cetak.php プロジェクト: ardiqghenatya/invisible-app
<?php

include "../config/config.php";
include "../pdf/fpdf/fpdf.php";
//include "../barcode/barcode.php";
//include "../barcode/bars.php";
$pdf = new FPDF();
$pdf->Open();
$pdf->addPage();
$pdf->setAutoPageBreak(true);
$pdf->setFont('Arial', '', 12);
$pdf->text(10, 25, 'Tes User DB');
$pdf->Line(10, 31, 198, 31);
$yi = 50;
$ya = 44;
$pdf->setFont('Arial', '', 9);
$pdf->setFillColor(222, 222, 222);
$pdf->setXY(10, $ya);
$pdf->CELL(6, 6, 'ID', 1, 0, 'C', 1);
$pdf->CELL(40, 6, 'Username', 1, 0, 'C', 1);
$pdf->CELL(50, 6, 'Password', 1, 0, 'C', 1);
$ya = $yi + $row;
$sql = "SELECT id, password, username FROM user";
$result = $conn->query($sql);
$i = 1;
$no = 1;
$max = 31;
//$row = 6;
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $pdf->setXY(10, $ya);