本文整理汇总了PHP中pdf::Image方法的典型用法代码示例。如果您正苦于以下问题:PHP pdf::Image方法的具体用法?PHP pdf::Image怎么用?PHP pdf::Image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pdf
的用法示例。
在下文中一共展示了pdf::Image方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: displayResults
//.........这里部分代码省略.........
$this->pdf->headTable($headPDF, $tablePDF);
//$this->pdf->tableintopdf($tablePDF);
// if(isset($footPDF))
// foreach($footPDF as $foot)
// {
// $footA = array($foot);
// $this->pdf->tablehead($footA);
// }
if (isset($headPDF2)) {
$this->pdf->headTable($headPDF2, $tablePDF2);
}
}
if ($outputType == 'xls' && (isset($headXLS) || isset($tableXLS))) {
if (isset($headXLS)) {
$this->xlsRow++;
$this->xlsRow++;
foreach ($headXLS as $aRow) {
$this->xlsRow++;
$iColumn = 0;
foreach ($aRow as $sValue) {
$this->sheet->write($this->xlsRow, $iColumn, $sValue, $this->formatBold);
$iColumn++;
}
}
}
if (isset($tableXLS)) {
foreach ($tableXLS as $aRow) {
$this->xlsRow++;
$iColumn = 0;
foreach ($aRow as $sValue) {
$this->sheet->write($this->xlsRow, $iColumn, $sValue);
$iColumn++;
}
}
}
}
if ($outputType == 'html') {
$statisticsoutput .= "<tr><td colspan='4' style=\"text-align:center\" id='statzone_{$rt}'>";
}
//-------------------------- PCHART OUTPUT ----------------------------
list($qsid, $qgid, $qqid) = explode("X", $rt, 3);
$qsid = $surveyid;
$aattr = getQuestionAttributeValues($outputs['parentqid'], substr($rt, 0, 1));
//PCHART has to be enabled and we need some data
if ($usegraph == 1) {
$bShowGraph = $aattr["statistics_showgraph"] == "1";
$bAllowPieChart = $outputs['qtype'] != "M" && $outputs['qtype'] != "P";
$bAllowMap = isset($aattr["location_mapservice"]) && $aattr["location_mapservice"] == "1";
$bShowMap = $bAllowMap && $aattr["statistics_showmap"] == "1";
$bShowPieChart = $bAllowPieChart && (isset($aattr["statistics_graphtype"]) && $aattr["statistics_graphtype"] == "1");
$astatdata[$rt] = array('id' => $rt, 'sg' => $bShowGraph, 'ap' => $bAllowPieChart, 'am' => $bAllowMap, 'sm' => $bShowMap, 'sp' => $bShowPieChart);
$stats = Yii::app()->session['stats'];
$stats[$rt] = array('lbl' => $lbl, 'gdata' => $gdata, 'grawdata' => $grawdata);
Yii::app()->session['stats'] = $stats;
if ($bShowGraph == true) {
$cachefilename = createChart($qqid, $qsid, $bShowPieChart, $lbl, $gdata, $grawdata, $MyCache, $sLanguage, $outputs['qtype']);
if ($cachefilename) {
//introduce new counter
if (!isset($ci)) {
$ci = 0;
}
//increase counter, start value -> 1
$ci++;
switch ($outputType) {
case 'xls':
/**
* No Image for Excel...
*/
break;
case 'pdf':
$this->pdf->AddPage('P', 'A4');
$this->pdf->titleintopdf($pdfTitle, $titleDesc);
$this->pdf->Image($tempdir . "/" . $cachefilename, 0, 70, 180, 0, '', Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $surveyid), 'B', true, 150, 'C', false, false, 0, true);
break;
case 'html':
$statisticsoutput .= "<img src=\"{$tempurl}/" . $cachefilename . "\" border='1' />";
$aattr = getQuestionAttributeValues($qqid, $firstletter);
if ($bShowMap) {
$statisticsoutput .= "<div id=\"statisticsmap_{$rt}\" class=\"statisticsmap\"></div>";
$agmapdata[$rt] = array("coord" => getQuestionMapData(substr($rt, 1), $qsid), "zoom" => $aattr['location_mapzoom'], "width" => $aattr['location_mapwidth'], "height" => $aattr['location_mapheight']);
}
break;
default:
break;
}
}
}
}
//close table/output
if ($outputType == 'html') {
// show this block only when we show graphs and are not in the public statics controller
// this is because the links don't work from that controller
if ($usegraph == 1 && get_class(Yii::app()->getController()) !== 'Statistics_userController') {
$sImgUrl = Yii::app()->getConfig('adminimageurl');
$statisticsoutput .= "</td></tr><tr><td colspan='4'><div id='stats_{$rt}' class='graphdisplay' style=\"text-align:center\">" . "<img class='stats-hidegraph' src='{$sImgUrl}/chart_disabled.png' title='" . gT("Disable chart") . "' />" . "<img class='stats-showgraph' src='{$sImgUrl}/chart.png' title='" . gT("Enable chart") . "' />" . "<img class='stats-showbar' src='{$sImgUrl}/chart_bar.png' title='" . gT("Display as bar chart") . "' />" . "<img class='stats-showpie' src='{$sImgUrl}/chart_pie.png' title='" . gT("Display as pie chart") . "' />" . "<img class='stats-showmap' src='{$sImgUrl}/map_disabled.png' title='" . gT("Disable map display") . "' />" . "<img class='stats-hidemap' src='{$sImgUrl}/map.png' title='" . gT("Enable map display") . "' />" . "</div></td></tr>";
}
$statisticsoutput .= "</td></tr></table><br /> \n";
}
return array("statisticsoutput" => $statisticsoutput, "pdf" => $this->pdf, "astatdata" => $astatdata);
}
示例3: displayResults
//.........这里部分代码省略.........
//PCHART has to be enabled and we need some data
//
if ($usegraph == 1) {
$bShowGraph = $aattr["statistics_showgraph"] == "1";
$bAllowPieChart = $outputs['qtype'] != "M" && $outputs['qtype'] != "P";
$bAllowMap = isset($aattr["location_mapservice"]) && $aattr["location_mapservice"] == "1";
$bShowMap = $bAllowMap && $aattr["statistics_showmap"] == "1";
$bShowPieChart = $bAllowPieChart && (isset($aattr["statistics_graphtype"]) && $aattr["statistics_graphtype"] == "1");
$astatdata[$rt] = array('id' => $rt, 'sg' => $bShowGraph, 'ap' => $bAllowPieChart, 'am' => $bAllowMap, 'sm' => $bShowMap, 'sp' => $bShowPieChart);
$stats = Yii::app()->session['stats'];
$stats[$rt] = array('lbl' => $lbl, 'gdata' => $gdata, 'grawdata' => $grawdata);
Yii::app()->session['stats'] = $stats;
if ($bShowGraph == true) {
$cachefilename = '';
if ($outputType == 'xls' || $outputType == 'pdf') {
$cachefilename = createChart($qqid, $qsid, $bShowPieChart, $lbl, $gdata, $grawdata, $MyCache, $sLanguage, $outputs['qtype']);
}
if ($cachefilename || $outputType == 'html') {
//introduce new counter
if (!isset($ci)) {
$ci = 0;
}
//increase counter, start value -> 1
$ci++;
switch ($outputType) {
case 'xls':
/**
* No Image for Excel...
*/
break;
case 'pdf':
$this->pdf->AddPage('P', 'A4');
$this->pdf->titleintopdf($pdfTitle, $titleDesc);
$this->pdf->Image($tempdir . "/" . $cachefilename, 0, 70, 180, 0, '', Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $surveyid), 'B', true, 150, 'C', false, false, 0, true);
break;
case 'html':
if (isset($aattr["statistics_graphtype"])) {
$req_chart_type = $aattr["statistics_graphtype"];
}
//// If user forced the chartype from statistics_view
if (isset($_POST['charttype']) && $_POST['charttype'] != 'default') {
$req_chart_type = $_POST['charttype'];
}
//// The value of the select box in the question advanced setting is numerical. So we need to translate it.
if (isset($req_chart_type)) {
switch ($req_chart_type) {
case '1':
$charttype = "Pie";
break;
case '2':
$charttype = "Radar";
break;
case '3':
$charttype = "Line";
break;
case '4':
$charttype = "PolarArea";
break;
case '5':
$charttype = "Doughnut";
break;
default:
$charttype = "Bar";
break;
}
}
示例4: render
/**
* Handles rendering the element on the pdf.
*
* @param pdf $pdf the pdf object
* @param bool $preview true if it is a preview, false otherwise
*/
public function render($pdf, $preview)
{
global $CFG;
// If there is no element data, we have nothing to display.
if (empty($this->element->data)) {
return;
}
$imageinfo = json_decode($this->element->data);
// Get the image.
$fs = get_file_storage();
if ($file = $fs->get_file_by_hash($imageinfo->pathnamehash)) {
$contenthash = $file->get_contenthash();
$l1 = $contenthash[0] . $contenthash[1];
$l2 = $contenthash[2] . $contenthash[3];
$location = $CFG->dataroot . '/filedir' . '/' . $l1 . '/' . $l2 . '/' . $contenthash;
$pdf->Image($location, $this->element->posx, $this->element->posy, $imageinfo->width, $imageinfo->height);
}
}
示例5: datenbank
function ma2_pdf($id){
$return="";
$db=new datenbank();
$query="select * from rechnungen,mahnungen where rechnungen.renr=mahnungen.renr and mahnungen.manr='$id'";
$result=$db->query($query);
$rechnung=$db->get_object($result);
$result_kunde=$db->query("select * from kunden where kdnr=$rechnung->kunde");
$kunde=$db->get_object($result_kunde);
$pdf=new pdf('P', 'mm', 'A4');
$pdf->Open();
$pdf->AddPage();
$pdf->empfaenger($kunde->firma, $kunde->strasse." ".$kunde->hausnummer, $kunde->plz." ".$kunde->ort, $rechnung->manr, $rechnung->datum);
$pdf->SetFont('Arial','B',12);
$pdf->Cell(80,5,"Mahnung");
$pdf->Ln(10);
$pdf->SetFont("Arial", "", 10);
$pdf->Write(5, "Sehr geehrte Damen und Herren,\nleider konnte ich noch keinen Zahlungseingang zur Rechnung $rechnung->renr feststellen. Hier die Auflistung der aufgrund dieser Rechnung unbezahlten Posten::\n\n");
$query="select posten.datum as Datum, posten.kommentar as Beschreibung, posten.anzahl as Anzahl, produkte.name as Artikel, produkte.preis as Preis, (produkte.preis*posten.anzahl) as Summe from posten, produkte where posten.rechnung='$rechnung->renr' and produkte.id=posten.produkt";
$result=$db->query($query);
$header=array("Datum", "Beschreibung", "Anzahl", "Artikel", "Preis", "Summe");
while($data[]=$db->get_row($result))
{
}
$gammel=array_pop($data);
$pdf->table($header, $data);
$pdf->Ln();
$result=$db->query("SELECT Sum( posten.anzahl * produkte.preis ) AS Gesamt, Sum( posten.anzahl * produkte.preis * mwst.satz / 100 ) AS MWST, mwst.satz FROM posten, produkte, mwst WHERE produkte.id = posten.produkt AND mwst.id = produkte.mwst AND posten.rechnung = '$rechnung->renr' AND produkte.id!='3' AND produkte.id!='4' GROUP BY mwst.satz");
$betrag=$db->get_object($result);
$result=$db->query("SELECT Sum( posten.anzahl * produkte.preis ) AS Gesamt, Sum( posten.anzahl * produkte.preis * mwst.satz / 100 ) AS MWST, mwst.satz FROM posten, produkte, mwst WHERE produkte.id = posten.produkt AND mwst.id = produkte.mwst AND posten.rechnung = '$rechnung->renr' AND produkte.id ='3' GROUP BY mwst.satz");
$betrag2=$db->get_object($result);
$result=$db->query("SELECT Sum( posten.anzahl * produkte.preis ) AS Gesamt, Sum( posten.anzahl * produkte.preis * mwst.satz / 100 ) AS MWST, mwst.satz FROM posten, produkte, mwst WHERE produkte.id = posten.produkt AND mwst.id = produkte.mwst AND posten.rechnung = '$rechnung->renr' AND produkte.id ='4' GROUP BY mwst.satz");
$betrag3=$db->get_object($result);
$pdf->Cell(100,5,"", 0, 0, 'L');
$pdf->Cell(35,5,"Gesamt:",0,0,'L');
$pdf->Cell(20,5,number_format(($betrag->Gesamt+$betrag2->Gesamt+$betrag3->Gesamt),2,",",".").EURO, 0, 1, 'R');
$pdf->Cell(100,5,"", 0, 0, 'L');
$pdf->Cell(35,5,"Mehrwertsteuer (".number_format($betrag->satz)."%):", 0, 0, 'L');
$pdf->Cell(20,5,number_format($betrag->MWST,2,",",".").EURO, 0, 1, 'R');
$pdf->Ln();
$pdf->Cell(100,5,"", 0, 0, 'L');
$pdf->Cell(35,5,"Mahnbetrag:", 0, 0, 'L');
$pdf->Cell(20,5,number_format($betrag2->Gesamt+$betrag->Gesamt+$betrag3->Gesamt+$betrag->MWST,2,",",".").EURO, 0, 1, 'R');
$pdf->Ln();
$pdf->Write(5, "Bitte überweisen Sie den oben genannten Betrag bis spätestens zum $rechnung->faellig auf das unten aufgeführte Konto.\nÜber eine weitere Zusammenarbeit mit Ihnen würde ich mich sehr freuen und verbleibe mit freundlichen Grüßen\n");
$pdf->Ln(15);
$pdf->Write(5, $GLOBALS["conf"]["rechnung"]["adresse"]["name"]);
$pdf->Image($GLOBALS["conf"]["rechnung"]["unterschrift"],25,$pdf->GetY()-10,50);
$this->output=0;
$pdf->Output();
return $return;
}
示例6: certificate_output_entity_completion
/**
* Refactored code from @see certificate_output_completion()
* an array of parameters is passed and used by the certificate
* template file. It is up to the certificate template file to
* use whatever parameters are available
*
* @param array $params: An array of parameters (example: array('student_name' => 'some value'))
* Here are a list of values that can be used
* 'student_name', 'course_name', 'class_idnumber', 'class_enrol_time', 'class_enddate', 'class_grade',
* 'cert_timeissued', 'cert_code', 'class_instructor_name', 'course_description_name'
* (there will most likely be more when other entity types are added)
* @param string $border: A custom border image to use
* @param string $seal: A custom seal image to use
* @param string $template: A custom template to use
* @return string - pdf output
*/
function certificate_output_entity_completion($params, $border = '', $seal = '', $template = '')
{
global $CFG;
// Use the TCPDF library.
require_once $CFG->libdir . '/pdflib.php';
// Global settings.
$borders = 0;
$font = 'FreeSerif';
$largefontsize = 30;
$smallfontsize = 16;
// Create pdf.
$pdf = new pdf('L', 'in', 'Letter');
// Prevent the pdf from printing black bars.
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetAutoPageBreak(false);
$pdf->SetMargins(0, 0, 0, false);
$pdf->AddPage();
$pagewidth = $pdf->getPageWidth();
$pageheight = $pdf->getPageHeight();
// Draw the border.
cm_certificate_check_data_path('borders');
if (!empty($border)) {
if (file_exists($CFG->dirroot . '/local/elisprogram/pix/certificate/borders/' . $border)) {
$pdf->Image($CFG->dirroot . '/local/elisprogram/pix/certificate/borders/' . $border, 0, 0, $pagewidth, $pageheight);
} else {
if (file_exists($CFG->dataroot . '/local/elisprogram/pix/certificate/borders/' . $border)) {
$pdf->Image($CFG->dataroot . '/local/elisprogram/pix/certificate/borders/' . $border, 0, 0, $pagewidth, $pageheight);
}
}
}
// Draw the seal.
cm_certificate_check_data_path('seals');
if (!empty($seal)) {
if (file_exists($CFG->dirroot . '/local/elisprogram/pix/certificate/seals/' . $seal)) {
$pdf->Image($CFG->dirroot . '/local/elisprogram/pix/certificate/seals/' . $seal, 8.0, 5.8);
} else {
if (file_exists($CFG->dataroot . '/local/elisprogram/pix/certificate/seals/' . $seal)) {
$pdf->Image($CFG->dataroot . '/local/elisprogram/pix/certificate/seals/' . $seal, 8.0, 5.8);
}
}
}
// Include the certificate template.
cm_certificate_check_data_path('templates');
if (file_exists($CFG->dirroot . '/local/elisprogram/pix/certificate/templates/' . $template)) {
include $CFG->dirroot . '/local/elisprogram/pix/certificate/templates/' . $template;
} else {
if (file_exists($CFG->dataroot . '/local/elisprogram/pix/certificate/templates/' . $template)) {
include $CFG->dataroot . '/local/elisprogram/pix/certificate/templates/' . $template;
}
}
$pdf->Output();
}
示例7: displayResults
//.........这里部分代码省略.........
//-------------------------- PCHART OUTPUT ----------------------------
list($qsid, $qgid, $qqid) = explode("X", $rt, 3);
$qsid = $surveyid;
$aattr = getQuestionAttributeValues($outputs['parentqid'], substr($rt, 0, 1));
//PCHART has to be enabled and we need some data
if ($usegraph == 1) {
$bShowGraph = $aattr["statistics_showgraph"] == "1";
$bAllowPieChart = $outputs['qtype'] != "M" && $outputs['qtype'] != "P";
$bAllowMap = isset($aattr["location_mapservice"]) && $aattr["location_mapservice"] == "1";
$bShowMap = $bAllowMap && $aattr["statistics_showmap"] == "1";
$bShowPieChart = $bAllowPieChart && (isset($aattr["statistics_graphtype"]) && $aattr["statistics_graphtype"] == "1");
$astatdata[$rt] = array('id' => $rt, 'sg' => $bShowGraph, 'ap' => $bAllowPieChart, 'am' => $bAllowMap, 'sm' => $bShowMap, 'sp' => $bShowPieChart);
$stats = Yii::app()->session['stats'];
$stats[$rt] = array('lbl' => $lbl, 'gdata' => $gdata, 'grawdata' => $grawdata);
Yii::app()->session['stats'] = $stats;
if ($bShowGraph == true) {
$cachefilename = createChart($qqid, $qsid, $bShowPieChart, $lbl, $gdata, $grawdata, $MyCache, $sLanguage, $outputs['qtype']);
if ($cachefilename) {
//introduce new counter
if (!isset($ci)) {
$ci = 0;
}
//increase counter, start value -> 1
$ci++;
switch ($outputType) {
case 'xls':
/**
* No Image for Excel...
*/
break;
case 'pdf':
$this->pdf->AddPage('P', 'A4');
$this->pdf->titleintopdf($pdfTitle, $titleDesc);
$this->pdf->Image($tempdir . "/" . $cachefilename, 0, 70, 180, 0, '', Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $surveyid), 'B', true, 150, 'C', false, false, 0, true);
break;
case 'html':
//// This QD code generate the chart.js.
//// It's mixing PHP, JS and painfull from hell.
//// for more details, read : http://goo.gl/ylbikt
//// TODO : this is a rest of the first cycle of dev
//// Should be possible to use only one canvas now...
$pie_visibility = $radar_visibility = $line_visibility = $polar__visibility = $doughnut_visibility = $bar_visibility = 'hidden';
if (isset($aattr["statistics_graphtype"])) {
$req_chart_type = $aattr["statistics_graphtype"];
}
//// If user forced the chartype from statistics_view
if ($_POST['charttype'] != 'default') {
$req_chart_type = $_POST['charttype'];
}
//// The value of the select box in the question advanced setting is numerical. So we need to translate it.
if (isset($req_chart_type)) {
switch ($req_chart_type) {
case '1':
$charttype = "Pie";
$pie_visibility = ' active ';
break;
case '2':
$charttype = "Radar";
$radar_visibility = ' active ';
break;
case '3':
$charttype = "Line";
$line_visibility = ' active ';
break;
case '4':
$charttype = "PolarArea";