Example #1
0
 public function downloadPdf()
 {
     // header("Content-type: text/html; charset: utf-8;");
     require_once '/Data/ClassLib/Pdf.class.php';
     $a = new \Pdf();
     $a->setHtmlBody($this->html);
     $a->build('downloadtest.pdf', 'D');
 }
 public function create()
 {
     $this->load->library('Mpdf');
     $html = "<b>Ví Dụ</b><br />Xuất file PDF";
     $mpdf = new Pdf();
     $mpdf->SetAutoFont(AUTOFONT_ALL);
     $mpdf->WriteHTML($html);
     $mpdf->Output("file/mpdf.pdf", 'I');
 }
Example #3
0
 public function actionImprimir()
 {
     // get your HTML raw content without any layouts or scrip
     $pasostramite = pasostramite::find()->all();
     $content = $this->renderPartial('_imprimir', ['pasostramite' => $pasostramite]);
     $header = $this->renderPartial('_header', ['pasostramite' => $pasostramite]);
     $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => $header, 'SetFooter' => ['{PAGENO}']]]);
     // return the pdf output as per the destination setting
     return $pdf->render();
 }
Example #4
0
 /**
  * Constructor.
  *
  * @return void
  */
 public function __construct($tagProperties = array())
 {
     $this->pdf = Pdf::singleton();
     if (isset($tagProperties['ID'])) {
         $this->id = $tagProperties['ID'];
         if (!isset($this->pdf->linksIds[$this->id])) {
             $this->pdf->linksIds[$this->id] = $this->pdf->AddLink();
         }
         $this->pdf->SetLink($this->pdf->linksIds[$this->id], -1);
     }
 }
 public function actionImprimirFiltro()
 {
     //echo'<pre>';print_r($_GET);echo'</pre>'; exit;
     $fechaInicial = date("d-m-Y", strtotime($_GET['fechas']["filtro"]["fechaInicial"]));
     $fechaFinal = date("d-m-Y", strtotime($_GET['fechas']["filtro"]["fechaFinal"]));
     $formato = 'fecha_ft >= "' . $fechaInicial . '" and fecha_ft <= "' . $fechaFinal . '"';
     $VisitasEscuelas = VisitasEscuelas::find()->where('fecha_ft >= :fechaInicial and fecha_ft <= :fechaFinal', ['fechaInicial' => $fechaInicial, 'fechaFinal' => $fechaFinal])->all();
     $content = $this->renderPartial('_imprimir', ['VisitasEscuelas' => $VisitasEscuelas]);
     $header = $this->renderPartial('_header', ['VisitasEscuelas' => $VisitasEscuelas]);
     $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => $header, 'SetFooter' => ['{PAGENO}']]]);
     // return the pdf output as per the destination setting
     return $pdf->render();
 }
 /**
  * Constructor.
  *
  * Parse the tag attributes and add the new line to the document.
  *
  * @param array $tagProperties tag properties
  * @return void
  */
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     $lineColor = $tagProperties['LINECOLOR'];
     if ($lineColor != '') {
         $drawColor = Xml2Pdf::convertColor($lineColor);
         $pdf->SetDrawColor($drawColor['r'], $drawColor['g'], $drawColor['b']);
     }
     $lineWidth = $tagProperties['LINEWIDTH'];
     if ($lineWidth != '') {
         $currentLW = $pdf->LineWidth;
         $pdf->SetLineWidth((double) $lineWidth);
     }
     $x1 = $this->mathEval($tagProperties['LEFT']);
     $x2 = $this->mathEval($tagProperties['RIGHT']);
     $y1 = $this->mathEval($tagProperties['TOP']);
     $y2 = $this->mathEval($tagProperties['TOP']);
     $pdf->Line((double) $x1, (double) $y1, (double) $x2, (double) $y2);
     $y1 = $this->mathEval($tagProperties['BOTTOM']);
     $y2 = $y1;
     $pdf->Line((double) $x1, (double) $y1, (double) $x2, (double) $y2);
     //$x1 = $this->mathEval($tagProperties['LEFT']);
     $x2 = $x1;
     $y1 = $this->mathEval($tagProperties['TOP']);
     $y2 = $this->mathEval($tagProperties['BOTTOM']);
     $pdf->Line((double) $x1, (double) $y1, (double) $x2, (double) $y2);
     $x1 = $this->mathEval($tagProperties['RIGHT']);
     $x2 = $x1;
     //$y1 = $this->mathEval($tagProperties['TOP']);
     //$y2 = $this->mathEval($tagProperties['BOTTOM']);
     $pdf->Line((double) $x1, (double) $y1, (double) $x2, (double) $y2);
     if ($lineWidth != '') {
         $pdf->SetLineWidth($currentLW);
     }
 }
Example #7
0
 public static function instance()
 {
     if (!$instance) {
         self::$instance = new Pdf();
     }
     return self::$instance;
 }
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     $x = $tagProperties['LEFT'];
     $y = $tagProperties['TOP'];
     $w = $tagProperties['WIDTH'];
     $h = $tagProperties['HEIGHT'];
     $r = $tagProperties['RADIUS'];
     $style = $tagProperties['STYLE'];
     $angle = $tagProperties['ANGLE'];
     $lineColor = $tagProperties['LINECOLOR'];
     if ($lineColor != '') {
         $drawColor = Xml2Pdf::convertColor($lineColor);
         $pdf->SetDrawColor($drawColor['r'], $drawColor['g'], $drawColor['b']);
     }
     $lineWidth = $tagProperties['LINEWIDTH'];
     if ($lineWidth != '') {
         $current = $pdf->LineWidth;
         $pdf->SetLineWidth((double) $lineWidth);
     }
     $pdf->RoundedRect($x, $y, $w, $h, $r, $angle, $style);
     if ($lineWidth != '') {
         $pdf->SetLineWidth($current);
     }
 }
 /**
  * Constructor.
  *
  * @param array $tagProperties tag properties
  * @return void
  */
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     if (isset($tagProperties['FILE'])) {
         $this->_styleSheet = $tagProperties['FILE'];
         $this->_parseStyleSheet();
         $pdf->addStyles($this->_styleTags);
     }
 }
Example #10
0
 function testEmbedHtmlImage()
 {
     // NOTE: to embed images, use <img src=""> tag but specify a path to an existing file
     $model = new \Core3\Model\Spreadsheet();
     $model->defineColumns(array('id', 'name'));
     $model->addRow(array('1', 'kalle'));
     $model->addRow(array('2', 'olle'));
     $imgFile = tempnam('/tmp', 'embedHtmlImage');
     $this->createJpeg($imgFile);
     $writer = new Pdf();
     $writer->setStartHtmlBlock('<img src="' . $imgFile . '"/><br/>');
     $writer->setEndHtmlBlock('<h2>GOODBYE</h2>');
     $data = $writer->render($model);
     unlink($imgFile);
     $reader = new \Core3\Reader\BinaryData\Document();
     $this->assertEquals(true, $reader->isRecognized($data));
     $this->assertEquals(true, $reader->isPdfData($data));
 }
Example #11
0
 public function print_brgy_leaders($voter_data = array(), $data = array())
 {
     $this->load->library('pdf');
     $pdf = new Pdf('L', 'mm', 'LETTER', true, 'UTF-8', false);
     $pdf->SetTitle('My Title');
     $pdf->SetHeaderMargin(30);
     $pdf->SetTopMargin(20);
     $pdf->setFooterMargin(10);
     $pdf->SetAutoPageBreak(true, 15);
     $pdf->SetAuthor('Author');
     $pdf->AddPage('L', 'LEGAL');
     $pdf->setY(30);
     $html = '';
     $html .= '<div style="text-align: center;"><b>Brgy Leaders</b> for<br/><b>' . $data['brgy'] . '</b></div>';
     $html .= '<br/>';
     $html .= '<br/>';
     $html .= '<table style="border: 1px solid #000;border-collapse: collapse;" border="1" cellspacing="0" cellpadding="1">';
     $html .= '<thead>';
     $html .= '<tr style="background-color: #a8a8a8;">';
     $html .= '<th align="center" width="5%"></th>';
     $html .= '<th align="center" width="45%"><b>Voter\'s Name</b></th>';
     $html .= '<th align="center" width="30%"><b>Precinct No</b></th>';
     $html .= '<th align="center" width="20%"><b>Type</b></th>';
     $html .= '</tr>';
     $html .= '</thead>';
     if (count($voter_data) > 0) {
         $x = 1;
         foreach ($voter_data as $type => $val) {
             for ($ctr = 0; $ctr < count($val); $ctr++) {
                 $html .= '<tr nobr="true">';
                 $html .= '<td align="center" width="5%">' . $x . '.</td>';
                 $html .= '<td width="45%"> &nbsp;&nbsp;&nbsp;' . $val[$ctr]['full_name'] . '</td>';
                 $html .= '<td width="30%"> &nbsp;&nbsp;&nbsp;' . $val[$ctr]['precinct_no'] . '</td>';
                 $html .= '<td width="20%"> &nbsp;&nbsp;&nbsp;' . $val[$ctr]['type'] . '</td>';
                 $html .= '</tr>';
                 $x++;
             }
         }
     } else {
         $html .= '<tr>';
         $html .= '<td align="center" width="100%">No record found..</td>';
         $html .= '</tr>';
     }
     $html .= '</table>';
     $pdf->writeHTML($html, true, false, false, false, '');
     $pdf->Output('brgy_leaders_report.pdf', 'I');
 }
Example #12
0
 /**
  *
  *
  */
 public function renderPdf(Student $student)
 {
     $html = view($this->getHtmlView())->with('responses', $this->responses)->with('student', $student)->render();
     if (isset($_GET['html'])) {
         return $html;
     }
     $pdfOptions = ['margin-top' => 20, 'margin-bottom' => 10, 'margin-left' => 10, 'margin-right' => 10, 'zoom' => config('iep.html_renderer_zoom')];
     if ($this->headerViewEixsts()) {
         $header = view($this->getHeaderView())->with('responses', $this->responses)->with('student', $student)->render();
         $pdfOptions['header-html'] = $header;
         $pdfOptions['header-spacing'] = 2;
     }
     $pdf = new Pdf($pdfOptions);
     $pdf->addPage($html);
     $savePath = $this->getSavePath($student->lastfirst);
     if (!$pdf->saveAs($savePath)) {
         throw new Exception($pdf->getError());
     }
     return $savePath;
 }
Example #13
0
 /**
  * Constructor.
  *
  * @param $tagProperties tag attributes
  * @return void
  */
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     if (isset($tagProperties['TITLE'])) {
         $pdf->setTitle($tagProperties['TITLE']);
     }
     if (isset($tagProperties['SUBJECT'])) {
         $pdf->setSubject($tagProperties['SUBJECT']);
     }
     if (isset($tagProperties['CREATOR'])) {
         $pdf->setCreator($tagProperties['CREATOR']);
     }
 }
Example #14
0
 public function generarListadogeneneral()
 {
     $nombre = $this->input->get("nombre") != '' ? "LIKE '%" . $this->input->get("nombre") . "%'" : 'LIKE "%"';
     $apellido = $this->input->get("apellido") != '' ? "LIKE '%" . $this->input->get("apellido") . "%'" : 'LIKE "%"';
     $pdf = new Pdf('l', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetSubject('Tutorial TCPDF');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // $pdf->SetHeaderData(PDF_HEADER_LOGO,PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING,array(0,64,255),array(0,64, 128));
     $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128));
     // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config
     // $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,'Listado General',PDF_HEADER_STRING,array(0,64,255), array(0,64,128));
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->SetPageOrientation('p');
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //relación utilizada para ajustar la conversión de los píxeles
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // establecer el modo de fuente por defecto
     $pdf->setFontSubsetting(true);
     $pdf->SetFont('times', '', 9, '', true);
     $pdf->AddPage();
     $html = null;
     $nombre_archivo = null;
     // Establecemos el contenido para imprimir
     $resultado = $this->ReporteGeneral_model->getlistadogeneral($nombre, $apellido);
     if ($resultado) {
         $html = '';
         $html .= "<style type=text/css>";
         $html .= "th{color: #fff; font-weight: bold; background-color: #0B615E; align=center}";
         $html .= "td{background-color: #fff; color: #222; align=center}";
         $html .= "</style>";
         $html .= "<h2>Listado General de las Personas con Permisos</h2>";
         $html .= "<table width='100%' border='1' cellpadding='0' cellspacing='0' >";
         $html .= "<tr>\r\n            <th><em>Fecha del Permiso</em></th>\r\n            <th><em>Cédula</em></th>\r\n            <th><em>Nombres</em></th>\r\n            <th><em>Cantidad de salidas</em></th>\r\n            <th><em>Departamento</em></th>\r\n            <th><em>Motivo</em></th>\r\n            </tr>";
         foreach ($resultado as $fila) {
             $html .= '<tr>
                 <td>' . mb_convert_case($fila["fechaautorizacion"], MB_CASE_TITLE, "UTF-8") . '</td>
                 <td>' . mb_convert_case($fila["cedula"], MB_CASE_TITLE, "UTF-8") . '</td>
                 <td>' . mb_convert_case($fila["nombre"], MB_CASE_TITLE, "UTF-8") . '  ' . mb_convert_case($fila["apellido"], MB_CASE_TITLE, "UTF-8") . '</td>
                 <td>' . mb_convert_case($fila["contsalida"], MB_CASE_TITLE, "UTF-8") . '</td>
                 <td>' . mb_convert_case($fila["departamento"], MB_CASE_TITLE, "UTF-8") . '</td>
                 <td>' . mb_convert_case($fila["motivo"], MB_CASE_TITLE, "UTF-8") . '</td>
            </tr>
         <hr>';
         }
         $html .= "</table>";
         $cantidad = count($resultado);
         if ($cantidad > 1) {
             $html .= "<h4>Actualmente: " . count($resultado) . " empleados con permisos</h4>";
         } else {
             $html .= "<h4>Actualmente: " . count($resultado) . " empleados con permisos</h4>";
         }
         $nombre_archivo = utf8_decode("Listado General.pdf");
     } else {
         $html = '';
         $html .= "<style type=text/css>";
         $html .= "th{color: #fff; font-weight: bold; background-color: #AAC7E3}";
         $html .= "td{background-color: #fff; color: #222}";
         $html .= "</style>";
         $html .= "<h4>Listado General de las Personas con Permisos</h4>";
         $html .= "<table width='100%'>";
         $html .= "<tr><th>No hay empleados de permiso con las características indicadas</th></tr>";
         $html .= "</table>";
         $nombre_archivo = utf8_decode("Listado General " . $nombre . ".pdf");
     }
     $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true);
     $pdf->Output($nombre_archivo, 'I');
 }
Example #15
0
 /**
  * Processes a process
  *
  * Called when this component receives an HTTP POST request to
  * /process(/).
  */
 public function postProcess()
 {
     $this->app->response->setStatus(201);
     $header = $this->app->request->headers->all();
     $body = $this->app->request->getBody();
     $process = Process::decodeProcess($body);
     // always been an array
     $arr = true;
     if (!is_array($process)) {
         $process = array($process);
         $arr = false;
     }
     // this array contains the indices of the inserted objects
     $res = array();
     foreach ($process as $pro) {
         $eid = $pro->getExercise()->getId();
         // loads the form from database
         $result = Request::routeRequest('GET', '/form/exercise/' . $eid, $this->app->request->headers->all(), '', $this->_formDb, 'form');
         // checks the correctness of the query
         if ($result['status'] >= 200 && $result['status'] <= 299) {
             // only one form as result
             $forms = Form::decodeForm($result['content']);
             $forms = $forms[0];
             $formdata = $pro->getRawSubmission()->getFile();
             $timestamp = $formdata->getTimeStamp();
             if ($timestamp === null) {
                 $timestamp = time();
             }
             if ($formdata !== null && $forms !== null) {
                 $formdata = Form::decodeForm($formdata->getBody(true));
                 if (is_array($formdata)) {
                     $formdata = $formdata[0];
                 }
                 if ($formdata !== null) {
                     // evaluate the formdata
                     $points = 0;
                     $answers = $formdata->getChoices();
                     $correctAnswers = $forms->getChoices();
                     $allcorrect = true;
                     if ($forms->getType() == 0) {
                         $parameter = explode(' ', strtolower($pro->getParameter()));
                         if ($parameter === null || count($parameter) === 0 || $parameter[0] === '') {
                             if (DefaultNormalizer::normalizeText($correctAnswers[0]->getText()) != DefaultNormalizer::normalizeText($answers[0]->getText())) {
                                 $allcorrect = false;
                             }
                         } elseif (strtolower($parameter[0]) === 'distance1') {
                             $similarity = 0;
                             similar_text(DefaultNormalizer::normalizeText($answers[0]->getText()), DefaultNormalizer::normalizeText($correctAnswers[0]->getText()), $similarity);
                             if (isset($parameter[1])) {
                                 if ($similarity < $parameter[1]) {
                                     $allcorrect = false;
                                 }
                             } else {
                                 if ($similarity < 100) {
                                     $allcorrect = false;
                                 }
                             }
                         } elseif (strtolower($parameter[0]) === 'regularexpression') {
                             $i = 1;
                             $test = $parameter[$i];
                             while ($i < count($parameter)) {
                                 if (@preg_match($test, DefaultNormalizer::normalizeText($answers[0]->getText())) !== false) {
                                     break;
                                 }
                                 $test .= ' ' . $parameter[$i];
                                 $i++;
                             }
                             $match = @preg_match($test, DefaultNormalizer::normalizeText(DefaultNormalizer::normalizeText($answers[0]->getText())));
                             if ($match === false || $match == false || $test == '') {
                                 $allcorrect = false;
                             }
                         }
                     } elseif ($forms->getType() == 1) {
                         foreach ($correctAnswers as $mask) {
                             $foundInStudentsAnswer = false;
                             foreach ($answers as $answer) {
                                 if ($answer->getText() === $mask->getChoiceId()) {
                                     $foundInStudentsAnswer = true;
                                     break;
                                 }
                             }
                             if ($mask->getCorrect() === '1' && !$foundInStudentsAnswer) {
                                 $allcorrect = false;
                                 break;
                             } elseif ($mask->getCorrect() === '0' && $foundInStudentsAnswer) {
                                 $allcorrect = false;
                                 break;
                             }
                         }
                     } elseif ($forms->getType() == 2) {
                         foreach ($correctAnswers as $mask) {
                             $foundInStudentsAnswer = false;
                             foreach ($answers as $answer) {
                                 if ($answer->getText() === $mask->getChoiceId()) {
                                     $foundInStudentsAnswer = true;
                                     break;
                                 }
                             }
                             if ($mask->getCorrect() === '1' && !$foundInStudentsAnswer) {
                                 $allcorrect = false;
                                 break;
                             } elseif ($mask->getCorrect() === '0' && $foundInStudentsAnswer) {
                                 $allcorrect = false;
                                 break;
                             }
                         }
                     }
                     if ($allcorrect) {
                         $points = $pro->getExercise()->getMaxPoints();
                     }
                     // save the marking
                     #region Form to PDF
                     if ($pro->getMarking() === null) {
                         $raw = $pro->getRawSubmission();
                         $exerciseName = '';
                         if ($raw !== null) {
                             $exerciseName = $raw->getExerciseName();
                         }
                         $answer = "";
                         if ($forms->getType() == 0) {
                             $answer = $formdata->getChoices()[0]->getText();
                         }
                         if ($forms->getType() == 1) {
                             $answer = $this->ChoiceIdToText($formdata->getChoices()[0]->getText(), $forms->getChoices());
                         }
                         if ($forms->getType() == 2) {
                             foreach ($formdata->getChoices() as $chosen) {
                                 $answer .= $this->ChoiceIdToText($chosen->getText(), $forms->getChoices()) . '<br>';
                             }
                         }
                         $answer2 = "";
                         foreach ($forms->getChoices() as $chosen) {
                             if ($chosen->getCorrect() === '1') {
                                 $answer2 .= $chosen->getText() . '<br>';
                             }
                         }
                         $Text = "<h1>AUFGABE {$exerciseName}</h1>" . "<hr>";
                         if ($forms->getTask() !== null && trim($forms->getTask()) != '') {
                             $Text .= "<p>" . "<h2>Aufgabenstellung:</h2>" . $forms->getTask() . "</p>";
                         }
                         $Text .= "<p>" . "<h2>Antwort:</h2>" . "<span style=\"color: " . ($points === 0 ? 'red' : 'black') . "\">" . $answer . "</span></p>";
                         if ($points === 0) {
                             $Text .= "<p>" . "<h2>L&ouml;sung:</h2><span style=\"color: green\">" . $answer2 . "</span></p>";
                         }
                         if ($forms->getSolution() !== null && trim($forms->getSolution()) != '') {
                             $Text .= "<p>" . "<h2>L&ouml;sungsbegr&uuml;ndung:</h2>" . $forms->getSolution() . "</p>";
                         }
                         $Text .= "<p style=\"text-align: center;\">" . "<h2><span style=\"color: red\">{$points}P</span></h2>" . "</p>";
                         $pdf = Pdf::createPdf($Text);
                         //echo Pdf::encodePdf($pdf);return;
                         $result = Request::routeRequest('POST', '/pdf', array(), Pdf::encodePdf($pdf), $this->_pdf, 'pdf');
                         // checks the correctness of the query
                         if ($result['status'] >= 200 && $result['status'] <= 299) {
                             $pdf = File::decodeFile($result['content']);
                             $pdf->setDisplayName($exerciseName . '.pdf');
                             $pdf->setTimeStamp($timestamp);
                             $pdf->setBody(null);
                             $submission = $pro->getSubmission();
                             if ($submission === null) {
                                 $submission = $pro->getRawSubmission();
                             }
                             $studentId = $pro->getRawSubmission() !== null ? $pro->getRawSubmission()->getStudentId() : null;
                             if ($studentId === null) {
                                 $studentId = $pro->getSubmission() !== null ? $pro->getSubmission()->getStudentId() : null;
                             }
                             $marking = Marking::createMarking(null, $studentId, null, null, null, null, 3, $points, $submission->getDate() !== null ? $submission->getDate() : time());
                             if (is_object($submission)) {
                                 $marking->setSubmission(clone $submission);
                             }
                             $marking->setFile($pdf);
                             $pro->setMarking($marking);
                         } else {
                             $res[] = null;
                             $this->app->response->setStatus(409);
                             continue;
                         }
                     }
                     #endregion
                     $rawSubmission = $pro->getRawSubmission();
                     $rawFile = $rawSubmission->getFile();
                     $rawFile->setBody(Form::encodeForm($formdata), true);
                     $rawSubmission->setFile($rawFile);
                     $rawSubmission->setExerciseId($eid);
                     $pro->setRawSubmission($rawSubmission);
                     $res[] = $pro;
                     continue;
                 }
             }
         }
         $this->app->response->setStatus(409);
         $res[] = null;
     }
     if (!$arr && count($res) == 1) {
         $this->app->response->setBody(Process::encodeProcess($res[0]));
     } else {
         $this->app->response->setBody(Process::encodeProcess($res));
     }
 }
Example #16
0
 public function __construct()
 {
     parent::__construct('emptyBinary');
 }
    function export_pdf07()
    {
        $this->load->library('pdf');
        ob_clean();
        $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
        $tbl = '';
        $tbl .= '
				<h3><u>MASTER USER</u></h3>
				<table border="0"  cellpadding="0" cellspacing="0" >
				 <tr >';
        $tbl .= '<th  align="center" bgcolor="#359AFF" width="30" >NO</th>';
        $tbl .= '<th   valign="middle" bgcolor="#359AFF" width="200" >USER NAME</th>';
        $tbl .= '<th   valign="middle" bgcolor="#359AFF" width="250" >NAMA PEGAWAI</th>';
        $tbl .= '<th   valign="middle" bgcolor="#359AFF" width="180" >NAMA GROUP</th>';
        $tbl .= '<th   valign="middle" bgcolor="#359AFF" width="100" >AKTIF</th>';
        $tbl .= '</tr>';
        $sql = "select user_id,user_name,user_pwd,user_group_id, user_pegawai,if(user_aktif=1,'aktif','tidak aktif') st_user,user_aktif,group_id, group_nama from v_user where group_aktif=1";
        $data = $this->m_global->grid_view($sql)->result_array();
        $no = 1;
        foreach ($data as $row) {
            $bg = $no % 2;
            if ($bg == 0) {
                $bg = ' bgcolor="#E1F0FF" ';
            } else {
                $bg = ' bgcolor="#FFFFFF" ';
            }
            $tbl .= '
					<tr>
					<td ' . $bg . '  align="center" width="30">' . $no . '</td>';
            $tbl .= '<td ' . $bg . '  width="200" >' . $row['user_name'] . '</td>';
            $tbl .= '<td ' . $bg . '  width="250" >' . $row['user_pegawai'] . '</td>';
            $tbl .= '<td ' . $bg . '  width="180" >' . $row['group_nama'] . '</td>';
            $tbl .= '<td ' . $bg . '  width="100" >' . $row['st_user'] . '</td>';
            $tbl .= '</tr>';
            $no++;
        }
        $tbl .= '</table>';
        $pdf->AddPage();
        $pdf->SetFont('helvetica', '', 8);
        $pdf->writeHTML($tbl, true, false, false, false, '');
        $pdf->Output('example_048.pdf', 'I');
    }
Example #18
0
* MA  02110-1301  USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
if (Session::menu_perms('dashboard-menu', 'ControlPanelMetrics')) {
    $report_name = $report_data['report_name'];
    $subreport_name = $report_data['subreports'][$subreport_id]['name'];
    $title = $report_name . ' - ' . $subreport_name;
    include_once 'general.php';
    $pdf = new Pdf('OSSIM Metrics Report');
    $query_temp = new ArrayObject();
    $htmlPdfReport->pageBreak();
    $htmlPdfReport->setBookmark($title);
    $htmlPdfReport->set($htmlPdfReport->newTitle($subreport_name . ' - ' . _('Last Day (Compromise)'), $date_from, $date_to, NULL));
    //User
    $htmlPdfReport->set('<table class="tableTitle w100" style="margin-top:3px;"><tr><td class="w100">' . _('Global') . '</td></tr></table>');
    $htmlPdfReport->set('<table class="w100">');
    $query_temp['dayCompromiseGlobal'] = $pdf->MetricsNoPDF('day', 'compromise', 'global', '', $dates_filter['max_c_date'], $param['user']);
    if ($query_temp['dayCompromiseGlobal'][1][1] == '') {
        $query_temp['dayCompromiseGlobal'] = array($query_temp['dayCompromiseGlobal'][0]);
    }
    $data['asset'] = Session::get_session_user();
    $data['date'] = ' - ';
    $data['data'] = $query_temp['dayCompromiseGlobal'];
    createTable($data, &$htmlPdfReport);
Example #19
0
 function tiparire($fromDate, $toDate)
 {
     $this->load->model('cerere_model');
     $filtru = array('fromDate' => $fromDate, 'toDate' => $toDate);
     $cereri = $this->cerere_model->getCereriAll($filtru);
     $this->load->library('Pdf');
     $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetTitle('Cereri');
     $pdf->SetTopMargin(5);
     $pdf->setFooterMargin(5);
     $pdf->SetAutoPageBreak(true);
     $pdf->SetAuthor('poartacerului.ro');
     $pdf->SetDisplayMode('real', 'default');
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $output = "<strong>Cereri rugaciune din data {$fromDate} in data {$toDate}</strong>";
     foreach ($cereri as $cerere) {
         $output .= "<br /><br />Nume: " . $cerere['nume'] . ", Localitate: " . $cerere['localitate'] . ", Data: " . $cerere['data'];
         $output .= "<br />Continut: " . $cerere['continut'];
     }
     $pdf->PrintChapter($output, true);
     $pdf->Output('cereri-rugaciune.pdf', 'I');
 }
 public function generar()
 {
     $this->load->library('Pdf');
     $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Israel Parra');
     $pdf->SetTitle('Ejemplo de provincías con TCPDF');
     $pdf->SetSubject('Tutorial TCPDF');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config_alt.php de libraries/config
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 001', PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128));
     $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128));
     // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //relación utilizada para ajustar la conversión de los píxeles
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // ---------------------------------------------------------
     // establecer el modo de fuente por defecto
     $pdf->setFontSubsetting(true);
     // Establecer el tipo de letra
     //Si tienes que imprimir carácteres ASCII estándar, puede utilizar las fuentes básicas como
     // Helvetica para reducir el tamaño del archivo.
     $pdf->SetFont('freemono', '', 14, '', true);
     // Añadir una página
     // Este método tiene varias opciones, consulta la documentación para más información.
     $pdf->AddPage();
     //fijar efecto de sombra en el texto
     $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
     // Establecemos el contenido para imprimir
     $matricula = $this->input->post('provincia');
     $provincias = $this->modelo->getIdentificacion($matricula);
     foreach ($provincias as $fila) {
         $prov = $fila['nombre'];
     }
     //preparamos y maquetamos el contenido a crear
     $html = '';
     $html .= "<style type=text/css>";
     $html .= "th{color: #fff; font-weight: bold; background-color: #222}";
     $html .= "td{background-color: #AAC7E3; color: #fff}";
     $html .= "</style>";
     $html .= "<h2>Localidades de " . $prov . "</h2><h4>Actualmente: " . count($provincias) . " localidades</h4>";
     $html .= "<table width='100%'>";
     $html .= "<tr><th>Id localidad</th><th>Localidades</th></tr>";
     //provincias es la respuesta de la función getProvinciasSeleccionadas($provincia) del modelo
     foreach ($provincias as $fila) {
         $id = $fila['ap'];
         $localidad = $fila['am'];
         $html .= "<tr><td class='id'>" . $id . "</td><td class='localidad'>" . $localidad . "</td></tr>";
     }
     $html .= "</table>";
     // Imprimimos el texto con writeHTMLCell()
     $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
     // ---------------------------------------------------------
     // Cerrar el documento PDF y preparamos la salida
     // Este método tiene varias opciones, consulte la documentación para más información.
     $nombre_archivo = utf8_decode("Localidades de " . $prov . ".pdf");
     $pdf->Output($nombre_archivo, 'I');
 }
Example #21
0
 public function actionPdfAdmin($year, $month, $nip)
 {
     $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
     foreach ($roles as $role) {
         $cekrole = $role->name;
     }
     if ($cekrole == 'employee') {
         $status = Yii::app()->user->Id;
         //$nip = $this->loadModel2($status); /*User::model()->findByAttributes(array('id'=>$status));*/
         $command = Yii::app()->db->createCommand();
         $nipUser = $command->select('*')->from('profiles')->where('user_id=:id', array(':id' => $status))->queryRow();
     }
     if ($cekrole != 'supervisorMorena' and $cekrole != 'Admin' and $cekrole != 'adminMorena' and $nipUser['nip'] != $nip) {
         throw new CHttpException(403, 'You are not authorized to perform this action.');
     }
     $pdf = new Pdf('L', 'mm', 'A4');
     $noSlip = $year . $month . $nip;
     $model = $this->loadModelPdfAdmin($noSlip);
     if ($model == null) {
         throw new CHttpException(772, 'Salary Slip cannot be found in Database, please check NIP, Year, or Month in Payroll Management.');
     }
     $model2 = $this->loadModel2($nip);
     if ($model2 == null) {
         throw new CHttpException(772, 'Data Employee not found!');
     }
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetFont('Arial', '', 12);
     $pdf->mySurat($model2['firstname'], $model2['lastname'], $model2['position'], $model2['departement'], $model2['location'], $model2['class'], $model2['marriageStatus'], $model->noSlipGaji, $model->year, $model->month, $model->nip, $model->workDays, $model->grossSalary, $model->fixAllowance, $model->pulse, $model->medicalAllowance, $model->overtime, $model->bonus, $model->thr, $model->correctionPlus, $model->incentive, $model->jobAllowance, $model->marriageAllowance, $model->houseAllowance, $model->maternityAllowance, $model->glassesAllowance, $model->condolanceAllowance, $model->separationPay, $model->opex, $model->coc, $model->pph21, $model->bpjs, $model->jamsostek, $model->benefitMin, $model->copAllowanceMin, $model->koperasi, $model->mcs, $model->loan, $model->meal, $model->transport, $model->taskForceAllowance);
     $pdf->Output("SALARY-SLIP-" . $model->nip . '-' . $model->month . '-' . $model->year . ".pdf", 'D');
     //	}
     //	else {
     //				throw new CHttpException(403,'You are not authorized to perform this action.');
     //				}
 }
 function generar()
 {
     $this->load->library('Pdf');
     $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Cony Jaramillo');
     $pdf->SetTitle('Combrobante');
     $pdf->SetSubject('Registro Coordinadores y Promotores');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     ob_start();
     // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config_alt.php de libraries/config
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0, 64, 255), array(0, 1, 0));
     $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128));
     // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //relación utilizada para ajustar la conversión de los píxeles
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // ---------------------------------------------------------
     // establecer el modo de fuente por defecto
     $pdf->setFontSubsetting(true);
     // Establecer el tipo de letra
     $pdf->SetFont('helvetica', '', 14, '', true);
     // Añadir una página
     // Este método tiene varias opciones, consulta la documentación para más información.
     $pdf->AddPage();
     //fijar efecto de sombra en el texto
     $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(255, 255, 255), 'opacity' => 1, 'blend_mode' => 'Normal'));
     // Establecemos el contenido para imprimir
     $data['nombre'] = $this->input->post('nombre');
     $data['folio'] = $this->input->post('folio');
     $data['correo'] = $this->input->post('correo');
     $data['fecha'] = $this->input->post('fecha');
     $data['plantel'] = $this->input->post('plantel');
     $data['institucion'] = $this->input->post('institucion');
     $data['tipo_registro'] = $this->input->post('tipo_registro');
     $matricula = $this->input->post('matricula');
     //preparamos y maquetamos el contenido a crear
     $html = "";
     $html .= "<style type=text/css>";
     $html .= " h1 {\n\t\t\t\t\t  \n\t\t\t\t\t    width: 100%;\n\t\t\t\t\t    font-weight: bold;\n\t\t\t\t\t    font-size: 13;\n\t\t\t\t\t    line-height: 2;\n\t\t\t\t\t    text-align: center;\n\t\t\t\t\t    color: #070005;\n\t\t\t\t\t}\n    \t\t\th2{\n    \t\t\t\t\ttext-align: justify;\n    \t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\tfont-size: 9;\n\t\t\t\t\t\tline-height: 1.5;\n    \t\t\t\t\tcolor:  #070005;\n    \t\t\t\t}\n    \t\t\th3{\n    \t\t\t\tline-height: 3;\n    \t\t\t\ttext-align: center;\n    \t\t\t\tfont-weight: normal;\n    \t\t\t\tfont-size: 9;\n    \t\t\t\t}\n\t\t\t\t\th4{\n    \t\t\t\t\ttext-align: center;\n    \t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\tfont-size: 10;\n\t\t\t\t\t\tline-height: 1;\n    \t\t\t\t\tcolor: #070005;\n\t\t\t\t}\n    \t\t\t\n    \t\t\th5{\n    \t\t\t\t\ttext-align: justify;\n    \t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\tfont-size: 10;\n\t\t\t\t\t\tline-height: 4;\n    \t\t\t\t\tcolor:  #070005;\n\t\t\t\t}\n    \t\t\tp {\n    \t\t\t \tline-height: 1.5;\n    \t\t\t\tcolor: #5E5D5D;\n    \t\t\t\tfont-weight: bold;\n\t\t\t\t    text-align: justify;\n\t\t\t\t\t\n    \t\t\t\tfont-size: 9;\n    \t\t\t\t\n\t\t\t\t}\n    \t\t\t\t\n    \t\t\t\n\t\t\t";
     $html .= "</style>";
     $html .= '<h1>COMPROBANTE DE REGISTRO COMO ' . $data['tipo_registro'] . '<br> DEL PROGRAMA PREPA S&Iacute;</h1>';
     $html .= "<p><h5>" . $data['nombre'] . "</h5></p>";
     $html .= '<table border="0">
 			<tr>
 				<td><h2>FECHA DE REGISTRO</h2></td>
 				<td colspan="2"><p>' . $data['fecha'] . '</p></td>
 				
 			</tr>
 			<tr>
 				<td><h2>INSTITUCION</h2></td>
 				<td colspan="2"><p>' . $data['institucion'] . '</p></td>
 			</tr>
 			<tr>
 				<td><h2>PLANTEL</h2></td>
 				<td colspan="2"><p>' . $data['plantel'] . '</p></td>
 			</tr>
 			<tr>
 				<td colspan="3"><h4></h4></td>
 			</tr>
 			<tr>
 				<td colspan="3" bgcolor="#FBEFFB"><h4>FOLIO:   ' . $data['folio'] . '</h4></td>
 				
 			</tr>
 			
 			</table>';
     $html .= "<br><br><br><br><br><h3>Has quedado registrado, te sugerimos estar al pendiente de tu correo: <br> <u>" . $data['correo'] . "</u></h3>";
     // Imprimimos el texto con writeHTMLCell()
     $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
     $estilo = array('padding' => 'auto');
     $tipos = array('C128A');
     for ($i = 0; $i < sizeof($tipos); $i++) {
         $pdf->SetXY(78, 110);
         $pdf->Cell(45, 50, $matricula, 0, 0, 'C');
         $pdf->write1DBarcode($matricula, $tipos[$i], 75, 115, 50, 14, '', $estilo);
     }
     // ---------------------------------------------------------
     // Cerrar el documento PDF y preparamos la salida
     // Este método tiene varias opciones, consulte la documentación para más información.
     $nombre_archivo = utf8_decode("Registro_" . $data['folio'] . ".pdf");
     $pdf->Output($nombre_archivo, 'I');
     ob_end_flush();
 }
Example #23
0
                $text .= '<tr style="font-weight: bold;">';
            } else {
                $text .= '<tr>';
            }
            foreach ($row as $r) {
                $text .= '<td>' . $r . '</td>';
            }
            if ($key == 0) {
                $text .= '</tr>';
            } else {
                $text .= '</tr>';
            }
        }
        $text .= '</table>';
        $pdf = Pdf::createPdf($text, 'L');
        $file = http_post_data($filesystemURI . '/pdf', Pdf::encodePdf($pdf), true);
        $file = File::decodeFile($file);
        $file->setDisplayName('conditions.pdf');
        $file = File::encodeFile($file);
    } elseif (isset($_GET['downloadConditionCsv'])) {
        $csv = Csv::createCsv($rows);
        $file = http_post_data($filesystemURI . '/csv', Csv::encodeCsv($csv), true);
        $file = File::decodeFile($file);
        $file->setDisplayName('conditions.csv');
        $file = File::encodeFile($file);
    }
    echo $file;
    exit(0);
}
if (isset($_GET['sortby'])) {
    $condition_data['sortby'] = $_GET['sortby'];
Example #24
0
 /**      
  * Constructor.
  *
  * @param string $xml xml file or content
  * @return void
  */
 public function __construct($xml)
 {
     set_exception_handler(array('Xml2Pdf', 'exceptionHandler'));
     $this->_xml = $this->_getXmlContent($xml);
     $this->_pdf = Pdf::singleton();
 }
Example #25
0
 public function generarSalidaEmpleados()
 {
     $nacionalidad = $this->input->get("nacionalidad") != '' ? "LIKE '%" . $this->input->get("nacionalidad") . "%'" : 'LIKE "%"';
     $cedula = $this->input->get("cedula") != '' ? '=' . $this->input->get("cedula") : 'LIKE "%"';
     $nombre = $this->input->get("nombre") != '' ? "LIKE '%" . $this->input->get("nombre") . "%'" : 'LIKE "%"';
     $apellido = $this->input->get("apellido") != '' ? "LIKE '%" . $this->input->get("apellido") . "%'" : 'LIKE "%"';
     $pdf = new Pdf('p', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetSubject('Tutorial TCPDF');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // $pdf->SetHeaderData(PDF_HEADER_LOGO,PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING,array(0,64,255),array(0,64, 128));
     $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128));
     // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config
     // $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,'Listado General',PDF_HEADER_STRING,array(0,64,255), array(0,64,128));
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->SetPageOrientation('l');
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // se pueden modificar en el archivo tcpdf_config.php de libraries/config
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //relación utilizada para ajustar la conversión de los píxeles
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // establecer el modo de fuente por defecto
     $pdf->setFontSubsetting(true);
     $pdf->SetFont('times', '', 10, '', true);
     $pdf->AddPage();
     $pdf->Cell(44, 0, 'Cédula', 1, 0, 'C', 0, '', 0);
     $pdf->Cell(90, 0, 'Nombres y Apellidos', 1, 0, 'C', 0, '', 1);
     $pdf->Cell(44, 0, 'Sexo', 1, 0, 'C', 0, '', 1);
     $pdf->Cell(44, 0, 'Edo. Civil', 1, 0, 'C', 0, '', 1);
     $pdf->Cell(44, 0, 'Posee Partida', 1, 1, 'C', 0, '', 1);
     $pdf->Ln(5);
     $pdf->Cell(44, 0, 'Teléfono Móvil ', 1, 0, 'C', 0, '', 0);
     $pdf->Cell(90, 0, 'Municipio', 1, 0, 'C', 0, '', 1);
     $pdf->Cell(88, 0, 'Parroquia', 1, 0, 'C', 0, '', 1);
     $pdf->Cell(44, 0, 'Fecha Nac.', 1, 1, 'C', 0, '', 1);
     $pdf->Ln(5);
     $pdf->Cell(44, 0, 'Teléfono Local', 1, 0, 'C', 0, '', 0);
     $pdf->Cell(178, 0, 'Dirección', 1, 0, 'C', 0, '', 1);
     $pdf->Cell(44, 0, 'Edad', 1, 1, 'C', 0, '', 1);
     $pdf->Ln(5);
     $pdf->Cell(44, 0, 'CI Responsable', 1, 0, 'C', 0, '', 0);
     $pdf->Cell(90, 0, 'Nombres y Apellidos del Responsable', 1, 0, 'C', 0, '', 1);
     $pdf->Cell(130, 0, 'Dirección', 1, 0, 'C', 0, '', 1);
     // <td><b>CI Responsable</b></td>
     //                 <td colspan="2"><b>Nombres y Apellidos del Responsable</b></td>
     //                 <td colspan="3"><b>Dirección</b></td>
     //                     <td><b>Tipo Vivienda</b></td>
     //                 <td><b>Tenencia Vivienda</b></td>
     //                 <td><b>Parentesco</b></td>
     //                 <td><b>Padres Vivos</b></td>
     //                 <td>
     //                 <b>Nro. Personas</b>
     //                 </td>
     //                 <td><b>Convive con el Discapacitado</b></td>
     //                             <td><br><b>Condición/Discapacidad</b></td>
     //                 <td><br><b>Tipo Discapacidad</b></td>
     //                 <td colspan="2"><br><b>Diagnóstico Tipo Discapacidad</b></td>
     //                 <td><br><b>Certificado Informe Médico</b></td>
     //                 <td><br><b>Estatus</b></td>
     //                                 <td><b>Requiere  Medicamento</b></td>
     //                 <td colspan="2"><br><b>Nombre de los Medicamentos</b></td>
     //                 <td><br><b>Requiere Ayuda</b></td>
     //                 <td colspan="2"><br><b>Nombre de la Ayuda</b></td>
     //                         <td ><b>Grado de instrucción</b></td>
     //                 <td colspan="2"><b>Deseo de continuar Estudiando</b></td>
     //                 <td colspan="2"><b>Condiciones para seguir Estudiando</b></td>
     //                 <td><b>Limitación de Estudio</b></td>
     // ---------------------------------------------------------
     //Close and output PDF document
     $pdf->Output('example_004.pdf', 'I');
 }
Example #26
0
 public function ticketPdf()
 {
     $ticket = $this->input->get("ticket");
     $pdf = new Pdf('L', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->setPageOrientation('p');
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins(PDF_MARGIN_LEFT, 15, PDF_MARGIN_RIGHT);
     //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $pdf->setFontSubsetting(true);
     $pdf->SetFont('times', '', 12, '', true);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->AddPage();
     $html = null;
     $buscarTicket = $this->ticket_model->buscarTicket($ticket);
     $buscarTicketSector = $this->ticket_model->buscarTicketSector($ticket);
     if ($buscarTicket) {
         foreach ($buscarTicket as $fila1) {
             $html = '';
             $html .= "<style type=text/css>";
             $html .= "td{ color: #222}";
             $html .= "</style>";
             $html .= '<table border="0">
             <tr colspan="6">                        
                 <td colspan="2" align="left"><img alt="Imagen" src="imagen/logo/logoborde.png" width="220" heigth="90"/></td>
                 <td colspan="2" ><br></td>
                 <td colspan="2"><p align="right"><b>República Bolivariana de Venezuela<br>Gobernación del Estado Lara</b></p></td>
             </tr><br>
             <tr colspan="6">
                 <td colspan="6" align="right"><b>Ticket: ' . $fila1->codigo . '</b></td><br>
             </tr>
             <tr colspan="6">
                 <td colspan="6" align="right"><b>Barquisimeto, ' . $fila1->fecha . '</b></td>
             </tr><br>
             <tr colspan="6">
                 <td colspan="6" align="center"><b>REQUERIMIENTO</b></td>
             </tr>
             </table><br>
             
             <table border="1">                
             <tr colspan="6">
                 <td colspan="2" bgColor="#DCDCDC"><p align="center"><b>Solicitante:</b></p></td>
                 <td colspan="4"><p align="center">' . $fila1->solicitante . '</p></td><br>
             </tr>
             <tr colspan="6">
                 <td colspan="2" bgColor="#DCDCDC"><p align="center"><b>Tipo de requerimiento:</b></p></td>
                 <td colspan="4"><p align="center">' . $fila1->nombretipo . '</p></td><br>
             </tr>
             </table><br>';
             if ($fila1->tipoticket == 3) {
                 $html .= '
                 <table border="1">
                 <tr colspan="8">
                     <td colspan="8" bgColor="#DCDCDC"><p align="center"><b>DESCRIPCIÓN REQUERIMIENTO.-</b></p></td>
                 </tr>
                 <tr colspan="8">
                     <td colspan="3" bgColor="#DCDCDC"><p align="center"><b>Tipo de ayuda</b></p></td>
                     <td colspan="3" bgColor="#DCDCDC"><p align="center"><b>Descripción</b></p></td>
                     <td colspan="2" bgColor="#DCDCDC"><p align="center"><b>Cantidad</b></p></td>
                 </tr>';
                 foreach ($buscarTicketSector as $fila2) {
                     $variable = $fila2->nombresector;
                     $html .= '<tr colspan="8">
                         <td colspan="3"><p align="center">' . $fila2->ayudaticket . '</p></td>
                         <td colspan="3"><p align="center">' . $fila2->descripcion . '</p></td>
                         <td colspan="2"><p align="center">' . $fila2->cantidad . '</p></td>
                     </tr>';
                 }
                 $html .= '<tr colspan="8">
                     <td colspan="8" bgColor="#DCDCDC"><p align="center">SECTOR RELACIONADO AL REQUERIMIENTO: ' . $variable . '</p></td><br>
                 </tr>
                 </table>';
             } else {
                 $html .= '<table border="1">
                 <tr colspan="6">
                     <td colspan="6" bgColor="#DCDCDC"><p align="center">SECTOR RELACIONADO AL REQUERIMIENTO: ' . $fila1->nombresector . '</p></td><br>
                 </tr>
                 <tr colspan="6">
                     <td colspan="6" bgColor="#DCDCDC"><p align="center">DESCRIPCIÓN REQUERIMIENTO.-</p></td><br>
                 </tr>                
                 <tr colspan="6">
                     <td colspan="6"><p align="justify">' . $fila1->descripcion . '</p></td><br>
                 </tr>
                 </table>';
             }
         }
     } else {
         $pdf->SetFont('Times', 'B', 18);
         $pdf->Text(5, 25, 'No se encuentra Documento con las características indicadas.');
     }
     $nombre_archivo = utf8_decode("ticket.pdf");
     $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true);
     $pdf->Output($nombre_archivo, 'I');
 }
Example #27
0
 /**
  * Constructor.
  *
  * Parse the tag properties.
  *
  * @param object Pdf $pdf object Pdf
  * @param array $tagProperties tag properties
  * @return void
  */
 public function __construct($tagProperties)
 {
     parent::__construct($tagProperties);
     // parse the tag properties for text
     $pdf = Pdf::singleton();
     if (isset($tagProperties['FONT']) && $tagProperties['FONT'] != '') {
         $this->font = $tagProperties['FONT'];
     } else {
         $this->font = $pdf->pageFont;
     }
     if (isset($tagProperties['FONTSTYLE'])) {
         $this->fontStyle = $tagProperties['FONTSTYLE'];
     }
     if (isset($tagProperties['FONTCOLOR'])) {
         $this->fontColor = $tagProperties['FONTCOLOR'];
     }
     if (isset($tagProperties['FONTSIZE'])) {
         $this->fontSize = $tagProperties['FONTSIZE'];
     }
     if (isset($tagProperties['TEXTALIGN'])) {
         $this->textAlign = $tagProperties['TEXTALIGN'];
     }
     if (isset($tagProperties['LINEHEIGHT'])) {
         $this->lineHeight = $tagProperties['LINEHEIGHT'];
     }
     if (isset($tagProperties['BORDER'])) {
         $this->border = $tagProperties['BORDER'];
     }
     if (isset($tagProperties['WIDTH'])) {
         $this->width = $tagProperties['WIDTH'];
     }
     if (isset($tagProperties['LINESPACING'])) {
         $this->lineSpacing = $tagProperties['LINESPACING'];
     }
 }
Example #28
0
 public function reporteEstatusPdf()
 {
     $pdf = new Pdf('L', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->setPageOrientation('p');
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins(PDF_MARGIN_LEFT, 15, PDF_MARGIN_RIGHT);
     //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $pdf->setFontSubsetting(true);
     $pdf->SetFont('times', '', 12, '', true);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->AddPage();
     $html = null;
     $reporteEstatus = $this->reporteticket_model->reporteEstatusPDF();
     if ($reporteEstatus) {
         $pdf->Image("imagen/logo/logoborde.png", $x = 5, $y = 5, $w = 70, $h = 40, $type = '', $link = '', $align = 'right', $resize = false, $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, $hidden = false, $fitonpage = false, $alt = false, $altimgs = array());
         $pdf->Text(120, 15, "República Bolivariana de Venezuela", $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = 'left', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false);
         $pdf->Text(120, 20, "Gobernación del Estado Lara", $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = 'left', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false);
         $pdf->Text(120, 25, "Oficina de Atención al Ciudadano.", $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = 'left', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false);
         $pdf->SetFont('Times', 'B', 12);
         $pdf->Text(60, 50, 'Reporte estadistico del estatus de los Ticket registrados.');
         foreach ($reporteEstatus->result_array() as $fila) {
             $arregloDatos[] = array('estatus' => $fila['estatus'], 'contador' => $fila['contador']);
         }
         $pdf->Ln(10);
         $pdf->SetFillColor('150', '210', '255');
         $pdf->Cell(0, 0, 'Cuadro Resumen', 1, 1, 'C', 1);
         $pdf->Cell(75, 0, 'Tipo ticket', 1, 0, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M');
         $pdf->Cell(75, 0, 'Sector relacionado', 1, 0, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M');
         $pdf->Cell(30, 0, 'Cantidad', 1, 1, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M');
         $reporteCuadro = $this->reporteticket_model->reporteEstatusCuadroPDF();
         foreach ($reporteCuadro as $fila2) {
             $pdf->Cell(75, 0, $fila2->tipo, 1, 0, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M');
             $pdf->Cell(75, 0, $fila2->sector, 1, 0, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M');
             $pdf->Cell(30, 0, $fila2->cantidad, 1, 1, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M');
             $total = $fila2->total;
         }
         $pdf->Cell(150, 0, 'Total de ticket', 1, 0, 'R', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M');
         $pdf->Cell(30, 0, $total, 1, 1, 'C', 1);
         $pdf->Ln(10);
         $pdf->graficoPDF($arregloDatos, 'Grafico', array(60, '', 90, 100), '');
     } else {
         $pdf->SetFont('Times', 'B', 18);
         $pdf->Text(14, 40, 'No se encuentra información con las características indicadas.');
     }
     $nombre_archivo = utf8_decode("listado.pdf");
     $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true);
     $pdf->Output($nombre_archivo, 'I');
 }
Example #29
0
 /**
  * Constructor.
  *
  * @return void
  */
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     $formatArray = array('A3' => array(841.89, 1190.55), 'A4' => array(595.28, 841.89), 'A5' => array(420.94, 595.28), 'LETTER' => array(612, 791), 'LEGAL' => array(612, 1008));
     $unitArray = array('PT' => 1, 'MM' => 72 / 25.4, 'CM' => 72 / 2.54, 'IN' => 72);
     if (isset($tagProperties['FORMAT'])) {
         $format = strtoupper($tagProperties['FORMAT']);
         if (!isset($formatArray[$format])) {
             throw new Exception('unknow format page in tag body');
             die;
         }
         list($pdf->fwPt, $pdf->fhPt) = $formatArray[$format];
     }
     if (isset($tagProperties['ORIENTATION'])) {
         $orientation = strtoupper($tagProperties['ORIENTATION']);
         if ($orientation == 'P' || $orientation == 'PORTRAIT') {
             $pdf->DefOrientation = 'P';
             $pdf->wPt = $pdf->fwPt;
             $pdf->hPt = $pdf->fhPt;
         } elseif ($orientation == 'L' || $orientation == 'LANDSCAPE') {
             $pdf->DefOrientation = 'L';
             $pdf->wPt = $pdf->fhPt;
             $pdf->hPt = $pdf->fwPt;
         } else {
             throw new Exception('Incorrect orientation: ' . $orientation);
         }
     }
     if (isset($tagProperties['UNIT'])) {
         $unit = strtoupper($tagProperties['UNIT']);
         if (!isset($unitArray[$unit])) {
             throw new Exception('unknow unit scale in tag body');
             die;
         }
         $pdf->k = $unitArray[$unit];
     }
     if (isset($tagProperties['MARGINLEFT'])) {
         if (!is_float((double) $tagProperties['MARGINLEFT'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->lMargin = $tagProperties['MARGINLEFT'];
     }
     if (isset($tagProperties['MARGINRIGHT'])) {
         if (!is_float((double) $tagProperties['MARGINRIGHT'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->rMargin = $tagProperties['MARGINRIGHT'];
     }
     if (isset($tagProperties['MARGINTOP'])) {
         if (!is_float((double) $tagProperties['MARGINTOP'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->tMargin = $tagProperties['MARGINTOP'];
     }
     if (isset($tagProperties['MARGINBOTTOM'])) {
         if (!is_float((double) $tagProperties['MARGINBOTTOM'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->SetAutoPageBreak(true, $tagProperties['MARGINBOTTOM']);
     }
     if (isset($tagProperties['MARGINS'])) {
         if (!is_float((double) $tagProperties['MARGINS'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->lMargin = $tagProperties['MARGINS'];
         $pdf->rMargin = $tagProperties['MARGINS'];
         $pdf->tMargin = $tagProperties['MARGINS'];
         $pdf->SetAutoPageBreak(true, $tagProperties['MARGINS']);
     }
 }
Example #30
-1
 public function index()
 {
     $this->load->library('Pdf');
     $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->SetTitle('Pdf Example');
     $pdf->SetHeaderMargin(30);
     $pdf->SetTopMargin(20);
     $pdf->setFooterMargin(20);
     $pdf->SetAutoPageBreak(true);
     $pdf->SetAuthor('Author');
     $pdf->SetDisplayMode('real', 'default');
     $pdf->Write(5, 'CodeIgniter TCPDF Integration');
     $pdf->Output('pdfexample.pdf', 'I');
 }