Exemplo n.º 1
0
 private function _rotatedText($x, $y, $txt, $angle)
 {
     //Text rotated around its origin
     $this->_rotate($angle, $x, $y);
     $this->_pdf->Text($x, $y, $txt);
     $this->_rotate(0);
 }
 /**
  * @return TPDocumento
  * @param array $content
  */
 public function generatePDF($content)
 {
     define('FPDF_FONTPATH', 'bibliotecas/fpdf/font/');
     include 'bibliotecas/fpdf/fpdf.php';
     include 'bibliotecas/barcode/code128.php';
     $this->filename = $filename = sprintf('%s/TMP/%s.pdf', __CAM_UPLOAD__, CFUtils::random());
     $this->newname = sprintf('%s/0%s', $this->generateRepositoryForDigital($content['DIGITAL']), CFUtils::random());
     $pdf = new PDF_Code128();
     $pdf->SetFont('times', '', 12);
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->ln(2);
     $pdf->SetFont('Arial', '', 9);
     $pdf->Text(170, 12, __ETIQUETA__);
     $pdf->Code128(165, 14, $content['DIGITAL'], 30, 9);
     $pdf->Text(173, 27, $content['DIGITAL']);
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->Cell(180, 5, '', 0, 0, 'R');
     $pdf->Cell(5, 5, '', 0, 1, 'L');
     $pdf->Image("imagens/" . __LOGO_JPG__, 95, 8, 20, 20);
     $pdf->Ln(20);
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(22, 5, "Digital: ", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 8);
     $pdf->Cell(100, 5, $content['DIGITAL'], 0, 0, 'L');
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(18, 5, "Data do Documento:  ", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 8);
     $pdf->Cell(40, 5, CFUtils::formatDate($content['DT_DOCUMENTO']), 0, 1, 'R');
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(22, 5, "Origem:", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 8);
     $pdf->Cell(100, 5, utf8_decode($content['ORIGEM']), 0, 0, 'L');
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(18, 5, utf8_decode("Número Solicitação:  "), 0, 0, 'L');
     $pdf->SetFont("Arial", '', 8);
     $pdf->Cell(40, 5, utf8_decode($content['NUMERO']), 0, 1, 'R');
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(22, 5, "Interessado:", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 8);
     $pdf->Cell(100, 5, utf8_decode($content['INTERESSADO']), 0, 0, 'L');
     $pdf->Ln();
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->Cell(22, 5, "Assunto:", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 8);
     $pdf->MultiCell(165, 5, utf8_decode($content['ASSUNTO']), 0, 1);
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->Cell(35, 5, "Assunto Complementar:", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 8);
     $pdf->MultiCell(165, 5, utf8_decode($content['ASSUNTO_COMPLEMENTAR']), 0, 1);
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->Cell(22, 5, "Prioridade:", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 8);
     $pdf->MultiCell(165, 5, utf8_decode($content['NM_PRIORIDADE']), 0, 1);
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->Cell(22, 5, "Data do Prazo:", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 8);
     $pdf->MultiCell(165, 5, CFUtils::formatDate($content['DT_PRAZO']), 0, 1);
     $pdf->Ln();
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(195, 5, utf8_decode("Informações do Documento"), 0, 1, 'C');
     $pdf->Ln();
     $pdf->Cell(8, 5, '', 0, 0, 'C');
     $pdf->SetFont("Arial", '', 8);
     $pdf->Cell(40, 5, 'Ao ' . utf8_decode($content['DESTINO']), 0, 1, 'L');
     $pdf->Ln();
     $pdf->SetFont("Arial", '', 8);
     $pdf->Cell(8, 5, '', 0, 0, 'L');
     $pdf->Write(5, utf8_decode($content['SOLICITACAO']));
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont("Arial", "B", 8);
     $pdf->Cell(8, 5, '', 0, 0, 'L');
     $pdf->Write(5, utf8_decode($content['NOME']));
     $pdf->Output($filename, 'F');
     return $this;
 }
Exemplo n.º 3
0
$y_pos = 0;
$pdf->SetMargins(0, 0, 0, 0);
foreach ($data as $key) {
    if ($x_pos == 0 && $y_pos == 0) {
        $pdf->AddPage();
    }
    $pdf->Line(70 + $x_pos, 5 + $y_pos, 5 + $x_pos, 5 + $y_pos);
    // garis hor atas
    $pdf->Line(70 + $x_pos, 35 + $y_pos, 5 + $x_pos, 35 + $y_pos);
    // garis hor bawah
    $pdf->Line(5 + $x_pos, 35 + $y_pos, 5 + $x_pos, 5 + $y_pos);
    // garis ver kiri
    $pdf->Line(70 + $x_pos, 5 + $y_pos, 70 + $x_pos, 35 + $y_pos);
    // garis ver kanan
    $pdf->SetFont('Arial', 'B', 13);
    $pdf->Text(7 + $x_pos, 10 + $y_pos, "Kartu Anggota Ojek");
    $pdf->SetFont('Arial', '', 8);
    $pdf->Text(7 + $x_pos, 15 + $y_pos, 'Nama Lengkap : ' . $key->namalengkap . " " . $key->id);
    $pdf->Text(7 + $x_pos, 20 + $y_pos, 'No. HP : ' . $key->nohp);
    $pdf->Text(7 + $x_pos, 25 + $y_pos, 'Jenis Kelaimin : ' . $key->kelamin);
    $pdf->Code128(7 + $x_pos, 28 + $y_pos, $key->nohp, 40, 5);
    $x_pos = $x_pos + 70;
    if ($x_pos >= 150) {
        $x_pos = 0;
        $y_pos = $y_pos + 35;
        if ($y_pos >= 340) {
            $y_pos = 0;
        }
    }
}
$pdf->Output();