本文整理汇总了PHP中pdf类的典型用法代码示例。如果您正苦于以下问题:PHP pdf类的具体用法?PHP pdf怎么用?PHP pdf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了pdf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generar
/**
*
* @param int $id_emergencia
*/
public function generar($id_emergencia, $mapa = true, $codigo)
{
$emergencia = $this->_ci->emergencia_model->getById($id_emergencia);
if (!is_null($emergencia)) {
$data = array("eme_ia_id" => $emergencia->eme_ia_id, "eme_c_nombre_emergencia" => $emergencia->eme_c_nombre_emergencia, "eme_c_nombre_informante" => $emergencia->eme_c_nombre_informante, "eme_d_fecha_emergencia" => ISODateTospanish($emergencia->eme_d_fecha_emergencia, false), "hora_emergencia" => ISOTimeTospanish($emergencia->eme_d_fecha_emergencia), "hora_recepcion" => ISOTimeTospanish($emergencia->eme_d_fecha_recepcion), "eme_c_lugar_emergencia" => $emergencia->eme_c_lugar_emergencia, "emisor" => $this->_ci->session->userdata('session_nombres'), "id_usuario_encargado" => $emergencia->usu_ia_id, "eme_c_descripcion" => $emergencia->eme_c_descripcion, "est_ia_id" => $emergencia->est_ia_id, "tip_ia_id" => $emergencia->tip_ia_id);
$datos = unserialize($emergencia->eme_c_datos_tipo_emergencia);
foreach ($datos as $key => $value) {
$data['form_tipo_' . $key] = $value;
}
}
$data['codigo'] = $codigo;
$data['region'] = '';
$regiones = explode(',', $this->_ci->session->userdata('session_regiones'));
if (count($regiones) == 1) {
if ($regiones[0] == 13) {
$data['region'] = 'RM';
} else {
$data['region'] = $regiones[0] . 'º';
}
}
$data['cargo'] = $this->_ci->session->userdata('session_cargo');
$data['mapa'] = $mapa;
$html = $this->_ci->load->view('pages/emergencia_reporte/pdf', $data, true);
$this->_pdf->imagen_mapa = $this->_imagen;
$this->_pdf->imagen_logo = file_get_contents(FCPATH . "/assets/img/top_logo.png");
$this->_pdf->SetFooter($_SERVER['HTTP_HOST'] . '|{PAGENO}/{nb}|' . date('d-m-Y H:i'));
$this->_pdf->WriteHTML($html);
return $this->_pdf->Output('acta.pdf', 'S');
}
示例2: movie_get_file_metadata
/**
* Get PDF file metadata (height and width)
* (ref: movie::get_file_metadata())
*/
static function movie_get_file_metadata($file_path, $metadata)
{
if (strtolower(pathinfo($file_path, PATHINFO_EXTENSION)) == "pdf" && ($path = pdf::find_gs())) {
// Parsing gs output properly can be a pain. So, let's go for a reliable albeit inefficient
// approach: re-extract the frame (into tmp) and get its image size.
$temp_file = system::temp_filename("pdf_", "jpg");
pdf_event::movie_extract_frame($file_path, $temp_file, null, null);
list($metadata->height, $metadata->width) = photo::get_file_metadata($temp_file);
}
}
示例3: get_gs_version
/**
* Return version number of gs if found, an empty string if not.
* (ref: movie::get_ffmpeg_version())
*/
static function get_gs_version()
{
if (pdf::find_gs()) {
$path = module::get_var("pdf", "gs_path");
exec(escapeshellcmd($path) . " -version", $output);
if (stristr($output[0], "ghostscript")) {
// Found "ghostscript" in the response - it's valid.
return $output[0];
}
}
return "";
}
示例4: _print_screen
private function _print_screen($form)
{
// get module parameters
$gs_path = pdf::find_gs();
$gs_dir = substr($gs_path, 0, strrpos($gs_path, "/"));
$gs_version = pdf::get_gs_version();
// make and print view
$view = new Admin_View("admin.html");
$view->page_title = t("PDF settings");
$view->content = new View("admin_pdf.html");
$view->content->form = $form;
$view->content->gs_dir = $gs_dir;
$view->content->gs_version = $gs_version;
print $view;
}
示例5: certificate_output_completion
/**
* Outputs a certificate for some sort of completion element
*
* @param string $person_fullname The full name of the certificate recipient
* @param string $entity_name The name of the entity that is compelted
* @param string $certificatecode The unique certificate code
* @param string $date_string Date /time the certification was achieved
* @param string $curriculum_frequency the curriculum frequency
* @param string $expirydate A string representing the time that the
* certificate expires (optional).
*/
function certificate_output_completion($person_fullname, $entity_name, $certificatecode = '', $date_string, $expirydate = '', $curriculum_frequency = '', $border = '', $seal = '', $template = '')
{
global $CFG, $COURSE;
//use the TCPDF library
require_once $CFG->libdir . '/pdflib.php';
//global settings
$borders = 0;
$font = 'FreeSerif';
$large_font_size = 30;
$small_font_size = 16;
//create pdf
$pdf = new pdf('L', 'in', 'Letter');
//prevent the pdf from printing black bars
$pdf->print_header = false;
$pdf->print_footer = false;
//add main (only) page
$pdf->AddPage();
//draw the border
cm_certificate_check_data_path('borders');
if (file_exists($CFG->dirroot . '/curriculum/pix/certificate/borders/' . $border)) {
$pdf->Image($CFG->dirroot . '/curriculum/pix/certificate/borders/' . $border, 0.25, 0.25, 10.5, 8.0);
} else {
if (file_exists($CFG->dataroot . '/' . $COURSE->id . '/curriculum/pix/certificate/borders/' . $border)) {
$pdf->Image($CFG->dataroot . '/' . $COURSE->id . '/curriculum/pix/certificate/borders/' . $border, 0.25, 0.25, 10.5, 8.0);
}
}
//draw the seal
cm_certificate_check_data_path('seals');
if (file_exists($CFG->dirroot . '/curriculum/pix/certificate/seals/' . $seal)) {
$pdf->Image($CFG->dirroot . '/curriculum/pix/certificate/seals/' . $seal, 8.0, 5.8);
} else {
if (file_exists($CFG->dataroot . '/' . $COURSE->id . '/curriculum/pix/certificate/seals/' . $seal)) {
$pdf->Image($CFG->dataroot . '/' . $COURSE->id . '/curriculum/pix/certificate/seals/' . $seal, 8.0, 5.8);
}
}
//include template
cm_certificate_check_data_path('templates');
if (file_exists($CFG->dirroot . '/curriculum/pix/certificate/templates/' . $template)) {
include $CFG->dirroot . '/curriculum/pix/certificate/templates/' . $template;
} else {
if (file_exists($CFG->dataroot . '/' . $COURSE->id . '/curriculum/pix/certificate/templates/' . $template)) {
include $CFG->dirroot . '/curriculum/pix/certificate/templates/' . $template;
}
}
$pdf->Output();
}
示例6: actionView
/**
* printanswers::view()
* View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
* @param mixed $surveyid
* @param bool $printableexport
* @return
*/
function actionView($surveyid, $printableexport = FALSE)
{
Yii::app()->loadHelper("frontend");
Yii::import('application.libraries.admin.pdf');
$iSurveyID = (int) $surveyid;
$sExportType = $printableexport;
Yii::app()->loadHelper('database');
if (isset($_SESSION['survey_' . $iSurveyID]['sid'])) {
$iSurveyID = $_SESSION['survey_' . $iSurveyID]['sid'];
} else {
//die('Invalid survey/session');
}
// Get the survey inforamtion
// Set the language for dispay
if (isset($_SESSION['survey_' . $iSurveyID]['s_lang'])) {
$sLanguage = $_SESSION['survey_' . $iSurveyID]['s_lang'];
} elseif (Survey::model()->findByPk($iSurveyID)) {
$sLanguage = Survey::model()->findByPk($iSurveyID)->language;
} else {
$iSurveyID = 0;
$sLanguage = Yii::app()->getConfig("defaultlang");
}
$clang = SetSurveyLanguage($iSurveyID, $sLanguage);
$aSurveyInfo = getSurveyInfo($iSurveyID, $sLanguage);
//SET THE TEMPLATE DIRECTORY
if (!isset($aSurveyInfo['templatedir']) || !$aSurveyInfo['templatedir']) {
$aSurveyInfo['templatedir'] = Yii::app()->getConfig('defaulttemplate');
}
$sTemplate = validateTemplateDir($aSurveyInfo['templatedir']);
//Survey is not finished or don't exist
if (!isset($_SESSION['survey_' . $iSurveyID]['finished']) || !isset($_SESSION['survey_' . $iSurveyID]['srid'])) {
sendCacheHeaders();
doHeader();
echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array());
echo "<center><br />\n" . "\t<font color='RED'><strong>" . $clang->gT("Error") . "</strong></font><br />\n" . "\t" . $clang->gT("We are sorry but your session has expired.") . "<br />" . $clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), Yii::app()->getConfig("siteadminemail")) . "\n" . "</center><br />\n";
echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array());
doFooter();
exit;
}
//Fin session time out
$sSRID = $_SESSION['survey_' . $iSurveyID]['srid'];
//I want to see the answers with this id
//Ensure script is not run directly, avoid path disclosure
//if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
if ($aSurveyInfo['printanswers'] == 'N') {
die;
//Die quietly if print answers is not permitted
}
//CHECK IF SURVEY IS ACTIVATED AND EXISTS
$sSurveyName = $aSurveyInfo['surveyls_title'];
$sAnonymized = $aSurveyInfo['anonymized'];
//OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
//SHOW HEADER
$sOutput = CHtml::form(array("printanswers/view/surveyid/{$iSurveyID}/printableexport/pdf"), 'post') . "<center><input type='submit' value='" . $clang->gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
if ($sExportType == 'pdf') {
//require (Yii::app()->getConfig('rootdir').'/application/config/tcpdf.php');
Yii::import('application.libraries.admin.pdf', true);
Yii::import('application.helpers.pdfHelper');
$aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($clang->langcode);
$oPDF = new pdf();
$oPDF->SetTitle($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
$oPDF->SetSubject($sSurveyName);
$oPDF->SetDisplayMode('fullpage', 'two');
$oPDF->setLanguageArray($aPdfLanguageSettings['lg']);
$oPDF->setHeaderFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_MAIN));
$oPDF->setFooterFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_DATA));
$oPDF->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
$oPDF->AddPage();
$oPDF->titleintopdf($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
}
$sOutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$sSurveyName} ({$iSurveyID})</div><p> \n";
LimeExpressionManager::StartProcessingPage(true);
// means that all variables are on the same page
// Since all data are loaded, and don't need JavaScript, pretend all from Group 1
LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
$printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
$aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
//Get the fieldmap @TODO: do we need to filter out some fields?
if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
unset($aFullResponseTable['submitdate']);
} else {
unset($aFullResponseTable['id']);
}
unset($aFullResponseTable['token']);
unset($aFullResponseTable['lastpage']);
unset($aFullResponseTable['startlanguage']);
unset($aFullResponseTable['datestamp']);
unset($aFullResponseTable['startdate']);
$sOutput .= "<table class='printouttable' >\n";
foreach ($aFullResponseTable as $sFieldname => $fname) {
if (substr($sFieldname, 0, 4) == 'gid_') {
$sOutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
} elseif (substr($sFieldname, 0, 4) == 'qid_') {
//.........这里部分代码省略.........
示例7: pdf
}
else
$i=$sep+1;
$sep=-1;
$j=$i;
$l=0;
$nl++;
}
else
$i++;
}
return $nl;
}
}
$pdf = new pdf('L','mm','A4');
$pdf->AliasNbPages();
$titulos = array('FECHA','F. RECEPCION','SUCURSAL','GUIA','ORIGEN','DESTINO','INCIDENTE','RECIBIO','UNIDAD','RUTA');
$medidas = array(15,20,15,22,12,12,30,80,20,55);
$pdf->AddPage();
$pdf->SetFont('Arial','B',7);
//Table with 20 rows and 4 columns
$pdf->SetWidths($medidas);
$pdf->Titulos($titulos,$medidas);
$pdf->SetFont('Arial','',7);
for($i=0;$i<count($data);$i++){
$pdf->Row($data[$i]);
示例8: defined
<?php
/**
* @version 1.5.0
* @package Fi pdf
* @copyright Copyright (C) 2012 Fiyo Developers.
* @license GNU/GPL, see LICENSE.txt
**/
defined('_FINDEX_') or die('Access Denied');
$pdf = new pdf();
$pdf->category(app_param('label'), Page_ID, 1);
if (isset($pdf->category)) {
$category = $pdf->category;
$catlink = $pdf->catlink;
$text = $pdf->desc;
$pagelink = $pdf->pglink;
$link = $pdf->link;
$perrows = $pdf->perrows;
$author = $pdf->author;
$title = $pdf->title;
$title = $pdf->title;
$labels = $pdf->labels;
$hits = $pdf->hits;
$date = $pdf->date;
$label = ucfirst(app_param('label'));
if ($title) {
if (!empty($label)) {
echo "<h1 class='title'>{$label}</h1>";
} else {
if (defined('Apps_Title')) {
echo "<h1 class='title'>" . Apps_Title . "</h1>";
示例9: defined
<?php
/**
* @version 1.5.0
* @package Fi pdf
* @copyright Copyright (C) 2012 Fiyo Developers.
* @license GNU/GPL, see LICENSE.txt
**/
defined('_FINDEX_') or die('Access Denied');
$pdf = new pdf();
$pdf->category(app_param('id'), Page_ID);
if (isset($pdf->category)) {
$category = $pdf->category;
$catlink = $pdf->catlink;
$text = $pdf->desc;
$pagelink = $pdf->pglink;
$link = $pdf->link;
$perrows = $pdf->perrows;
$author = $pdf->author;
$title = $pdf->title;
$title = $pdf->title;
$labels = $pdf->labels;
$hits = $pdf->hits;
$date = $pdf->date;
$label = ucfirst(app_param('label'));
if ($title) {
if (!empty($label)) {
echo "<h1 class='title'>{$label}</h1>";
} else {
if (defined('PageTitle')) {
echo "<h1 class='title'>" . PageTitle . "</h1>";
示例10: __construct
function __construct(CController $controller)
{
parent::__construct();
$this->style = $controller->render('/admin/export/quexmlpdf_view', '', true);
}
示例11: pdf
<?php
use App\Http\Controllers\Pdf;
$pdf = new pdf();
$pdf->load();
$dompdf = new DOMPDF();
$html = '<html><body>' . '<h2>Mario Muñoz </h2>' . '<p> Primer tutorial de composer con laravel 5</p>' . '</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("report.pdf");
示例12: send
public function send($filename)
{
$doc = new pdf($this->orientation);
if ($this->title) {
$doc->setHeaderData('', 0, $this->title);
$doc->setPrintHeader(true);
} else {
$doc->setPrintHeader(false);
}
$doc->setPrintFooter(false);
foreach ($this->pages as $page) {
$doc->AddPage();
if ($page->title) {
$doc->writeHtml('<h2>' . $page->title . '</h2>');
}
// Find extent of the table.
$rows = $this->get_row_count($page);
$cols = $this->get_col_count($page);
$relwidths = $this->compute_relative_widths($page);
$o = html_writer::start_tag('table', array('border' => 1, 'cellpadding' => 1));
for ($row = 0; $row < $rows; $row++) {
$o .= html_writer::start_tag('tr');
$col = 0;
while ($col < $cols) {
$span = 1;
if (isset($page->mergers[$row][$col])) {
$mergewidth = (int) $page->mergers[$row][$col];
if ($mergewidth >= 1) {
$span = $mergewidth;
}
}
$opts = array();
if ($row == 0 && $relwidths[$col] > 0) {
$opts['width'] = $relwidths[$col] . '%';
}
if ($span > 1) {
$opts['colspan'] = $span;
}
$o .= html_writer::start_tag('td', $opts);
$cell = '';
if (isset($page->cells[$row][$col])) {
$cell = s($page->cells[$row][$col]);
if (isset($page->formats[$row][$col])) {
$thisformat = $page->formats[$row][$col];
if ($thisformat == 'header') {
$cell = html_writer::tag('b', $cell);
} else {
if ($thisformat == 'boldit') {
$cell = html_writer::tag('i', $cell);
}
}
}
}
$o .= $cell;
$o .= html_writer::end_tag('td');
$col += $span;
}
$o .= html_writer::end_tag('tr');
}
$o .= html_Writer::end_tag('table');
$doc->writeHtml($o);
}
$doc->Output($filename . '.pdf');
}
示例13: test_gs_path
/**
* Test that the configured path to ghostscript is correct and working.
* @param bool $generateimage - If true - a test image will be generated to verify the install.
* @return bool
*/
public static function test_gs_path($generateimage = true)
{
global $CFG;
$ret = (object) array('status' => self::GSPATH_OK, 'message' => null);
$gspath = \get_config('assignfeedback_editpdf', 'gspath');
if (empty($gspath)) {
$ret->status = self::GSPATH_EMPTY;
return $ret;
}
if (!file_exists($gspath)) {
$ret->status = self::GSPATH_DOESNOTEXIST;
return $ret;
}
if (is_dir($gspath)) {
$ret->status = self::GSPATH_ISDIR;
return $ret;
}
if (!is_executable($gspath)) {
$ret->status = self::GSPATH_NOTEXECUTABLE;
return $ret;
}
$testfile = $CFG->dirroot . '/mod/assign/feedback/editpdf/tests/fixtures/testgs.pdf';
if (!file_exists($testfile)) {
$ret->status = self::GSPATH_NOTESTFILE;
return $ret;
}
if (!$generateimage) {
return $ret;
}
$testimagefolder = \make_temp_directory('assignfeedback_editpdf_test');
@unlink($testimagefolder . '/image_page0.png');
// Delete any previous test images.
$pdf = new pdf();
$pdf->set_pdf($testfile);
$pdf->set_image_folder($testimagefolder);
try {
$pdf->get_image(0);
} catch (\moodle_exception $e) {
$ret->status = self::GSPATH_ERROR;
$ret->message = $e->getMessage();
}
return $ret;
}
示例14: pdf
}
if($c==' ')
$sep=$i;
$l+=$cw[$c];
if($l>$wmax)
{
if($sep==-1)
{
if($i==$j)
$i++;
}
else
$i=$sep+1;
$sep=-1;
$j=$i;
$l=0;
$nl++;
}
else
$i++;
}
return $nl;
}
}
$pdf = new pdf();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->adddetalle();
$pdf->Output();
?>
示例15: pdf
}
else
$i=$sep+1;
$sep=-1;
$j=$i;
$l=0;
$nl++;
}
else
$i++;
}
return $nl;
}
}
$pdf = new pdf('L','mm','Legal');
$pdf->AliasNbPages();
$titulos = array('GUIA','FECHA','FLETE','DESCUENTO','FLETE NETO','COMISION','RECOLECCION','COMISION RAD','ENTREGA','COMISION EAD','COM. SOBREPESO','TOTAL','TOTAL GRAL','CONDICION','STATUS');
$medidas = array(22,15,20,20,25,20,20,20,20,20,20,35,35,25,40);
$pdf->AddPage();
$pdf->SetFont('Arial','B',6);
$pdf->SetWidths($medidas);
$pdf->Titulos($titulos,$medidas);
$pdf->SetFont('Arial','',6);
for($i=0;$i<count($data);$i++){
$pdf->Row($data[$i]);
}