当前位置: 首页>>代码示例>>PHP>>正文


PHP Font_Metrics::get_font方法代码示例

本文整理汇总了PHP中Font_Metrics::get_font方法的典型用法代码示例。如果您正苦于以下问题:PHP Font_Metrics::get_font方法的具体用法?PHP Font_Metrics::get_font怎么用?PHP Font_Metrics::get_font使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Font_Metrics的用法示例。


在下文中一共展示了Font_Metrics::get_font方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_pdf

function create_pdf($data, $filename = '', $stream = TRUE, $papersize = 'letter', $orientation = 'portrait')
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html(' ');
    $dompdf->render();
    $canvas = $dompdf->get_canvas();
    $font = Font_Metrics::get_font("helvetica");
    $fontBold = Font_Metrics::get_font("helvetica", "bold");
    $row = 1;
    $y = 25;
    for ($i = 0; $i < count($data); $i++) {
        if (strpos($data[$i], "STUDENT") !== FALSE) {
            $canvas->text(40, $y += 15, $data[$i], $fontBold, 10, array(0, 0, 0));
        } elseif (strpos($data[$i], "COLLEGE") !== FALSE || strpos($data[$i], "UNIVERSITY") !== FALSE) {
            $canvas->text(40, $y += 15, $data[$i], $fontBold, 10, array(0, 0, 0));
        } elseif (strpos($data[$i], "__") !== FALSE || $data[$i] == " ") {
            $canvas->text(40, $y += 9, $data[$i], $font, 10, array(0, 0, 0));
        } else {
            $canvas->text(40, $y += 15, $data[$i], $font, 10, array(0, 0, 0));
        }
        if ($y > 730) {
            $dompdf->get_canvas()->new_page();
            $y = 50;
        }
    }
    if ($stream) {
        $dompdf->stream($filename . ".pdf");
    } else {
        return $dompdf->output();
    }
}
开发者ID:google-code-backups,项目名称:upm-oset,代码行数:32,代码来源:dompdf_helper.php

示例2: pdf_create

 function pdf_create($html, $filename, $stream = TRUE)
 {
     $dompdf = new DOMPDF();
     $dompdf->set_paper("A4");
     $dompdf->load_html($html);
     $dompdf->render();
     $canvas = $dompdf->get_canvas();
     // get height and width of page
     $w = $canvas->get_width();
     $h = $canvas->get_height();
     // get font
     $font = Font_Metrics::get_font("helvetica", "normal");
     $txtHeight = Font_Metrics::get_font_height($font, 7);
     //draw line for signature manager
     $mnline = $h - 10 * $txtHeight - 24;
     $colormn = array(0, 0, 0);
     $canvas->line(20, $mnline, $w - 470, $mnline, $colormn, 1);
     //text for signature Requestor/HOD
     $textmn = "Requestor/HOD";
     $widthmn = Font_Metrics::get_text_width($textmn, $font, 12);
     $canvas->text($w - $widthmn - 480, $mnline, $textmn, $font, 12);
     // draw a line along the bottom
     $y = $h - 2 * $txtHeight - 24;
     $color = array(0, 0, 0);
     $canvas->line(16, $y, $w - 16, $y, $color, 1);
     //draw line for GM/Manager
     //$canvas->line(270, $mnline, $w - 240, $mnline, $colormn, 1);
     $canvas->line(330, $mnline, $w - 170, $mnline, $colormn, 1);
     $texthr = "GM/Manager";
     $widthhr = Font_Metrics::get_text_width($texthr, $font, 12);
     $canvas->text($w - $widthmn - 160, $mnline, $texthr, $font, 12);
     //draw line for HR
     //$canvas->line(270, $mnline, $w - 240, $mnline, $colormn, 1);
     $canvas->line(180, $mnline, $w - 310, $mnline, $colormn, 1);
     $texthr = "HR";
     $widthhr = Font_Metrics::get_text_width($texthr, $font, 12);
     $canvas->text($w - $widthmn - 325, $mnline, $texthr, $font, 12);
     //draw line for IT Officer
     $canvas->line(470, $mnline, $w - 20, $mnline, $colormn, 1);
     $textIT = "IT Officer";
     $canvas->text($w - $widthmn - 30, $mnline, $textIT, $font, 12);
     // set page number on the left side
     //$canvas->page_text(16, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);
     $canvas->page_text($w - 324, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);
     // set additional text
     $text = "ESRNL PORTAL";
     $width = Font_Metrics::get_text_width($text, $font, 8);
     $canvas->text($w - $width - 16, $y, $text, $font, 8);
     if ($stream) {
         $dompdf->stream($filename . ".pdf");
     } else {
         $CI =& get_instance();
         $CI->load->helper('file');
         write_file($filename, $dompdf->output());
     }
 }
开发者ID:kielnevec,项目名称:PORTAL_Ingress_by_Fingertec,代码行数:56,代码来源:pdf.php

示例3: get_font_family

 /**
  * Getter for the 'font-family' CSS property.
  *
  * Uses the {@link Font_Metrics} class to resolve the font family into an
  * actual font file.
  *
  * @link http://www.w3.org/TR/CSS21/fonts.html#propdef-font-family
  * @return string
  */
 function get_font_family()
 {
     // Select the appropriate font.  First determine the subtype, then check
     // the specified font-families for a candidate.
     // Resolve font-weight
     $weight = $this->__get("font_weight");
     if (is_numeric($weight)) {
         if ($weight < 700) {
             $weight = "normal";
         } else {
             $weight = "bold";
         }
     } else {
         if ($weight == "bold" || $weight == "bolder") {
             $weight = "bold";
         } else {
             $weight = "normal";
         }
     }
     // Resolve font-style
     $font_style = $this->__get("font_style");
     if ($weight == "bold" && $font_style == "italic") {
         $subtype = "bold_italic";
     } else {
         if ($weight == "bold" && $font_style != "italic") {
             $subtype = "bold";
         } else {
             if ($weight != "bold" && $font_style == "italic") {
                 $subtype = "italic";
             } else {
                 $subtype = "normal";
             }
         }
     }
     // Resolve the font family
     $families = explode(",", $this->_props["font_family"]);
     reset($families);
     $font = null;
     while (current($families)) {
         list(, $family) = each($families);
         $font = Font_Metrics::get_font($family, $subtype);
         if ($font) {
             return $font;
         }
     }
     throw new DOMPDF_Exception("Unable to find a suitable font replacement for: '" . $this->_props["font_family"] . "'");
 }
开发者ID:artre,项目名称:study,代码行数:56,代码来源:style.cls.php

示例4: get_font_family

 /**
  * Getter for the 'font-family' CSS property.
  * Uses the {@link Font_Metrics} class to resolve the font family into an
  * actual font file.
  *
  * @link http://www.w3.org/TR/CSS21/fonts.html#propdef-font-family
  * @throws DOMPDF_Exception
  *
  * @return string
  */
 function get_font_family()
 {
     if (isset($this->_font_family)) {
         return $this->_font_family;
     }
     $DEBUGCSS = DEBUGCSS;
     //=DEBUGCSS; Allow override of global setting for ad hoc debug
     // Select the appropriate font.  First determine the subtype, then check
     // the specified font-families for a candidate.
     // Resolve font-weight
     $weight = $this->__get("font_weight");
     if (is_numeric($weight)) {
         if ($weight < 600) {
             $weight = "normal";
         } else {
             $weight = "bold";
         }
     } elseif ($weight === "bold" || $weight === "bolder") {
         $weight = "bold";
     } else {
         $weight = "normal";
     }
     // Resolve font-style
     $font_style = $this->__get("font_style");
     if ($weight === "bold" && ($font_style === "italic" || $font_style === "oblique")) {
         $subtype = "bold_italic";
     } elseif ($weight === "bold" && $font_style !== "italic" && $font_style !== "oblique") {
         $subtype = "bold";
     } elseif ($weight !== "bold" && ($font_style === "italic" || $font_style === "oblique")) {
         $subtype = "italic";
     } else {
         $subtype = "normal";
     }
     // Resolve the font family
     if ($DEBUGCSS) {
         print "<pre>[get_font_family:";
         print '(' . $this->_props["font_family"] . '.' . $font_style . '.' . $this->__get("font_weight") . '.' . $weight . '.' . $subtype . ')';
     }
     $families = preg_split("/\\s*,\\s*/", $this->_props["font_family"]);
     $font = null;
     foreach ($families as $family) {
         //remove leading and trailing string delimiters, e.g. on font names with spaces;
         //remove leading and trailing whitespace
         $family = trim($family, " \t\n\r\v\"'");
         if ($DEBUGCSS) {
             print '(' . $family . ')';
         }
         $font = Font_Metrics::get_font($family, $subtype);
         if ($font) {
             if ($DEBUGCSS) {
                 print '(' . $font . ")get_font_family]\n</pre>";
             }
             return $this->_font_family = $font;
         }
     }
     $family = null;
     if ($DEBUGCSS) {
         print '(default)';
     }
     $font = Font_Metrics::get_font($family, $subtype);
     if ($font) {
         if ($DEBUGCSS) {
             print '(' . $font . ")get_font_family]\n</pre>";
         }
         return $this->_font_family = $font;
     }
     throw new DOMPDF_Exception("Unable to find a suitable font replacement for: '" . $this->_props["font_family"] . "'");
 }
开发者ID:skyosev,项目名称:OpenCart-Overclocked,代码行数:78,代码来源:style.cls.php

示例5: utf8_decode

					<p>Recomendaciones al Item de ensayo Nº VARIABLE</p>
					<br /><br />	<br /><br />	<br /><br />
					<section>
					<p>Recomendaciones para el cultivo de cambur  cobrero establecido:</p>
					<br />
					<p>VARIABLE</p>
					</section>

					<p align="center"> Nombre del ing</p>
					<br />
					<p align="center">Los resultados del análisis corresponden únicamente a las muestras consignadas.
 <br />El presente informe no presenta enmienda ni tachadura.</p>
</body>
</html>';
$html = utf8_decode($html);
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$canvas = $dompdf->get_canvas();
$footer = $canvas->open_object();
$w = $canvas->get_width();
$h = $canvas->get_height();
$font = Font_Metrics::get_font("arial", "bold");
$canvas->page_text($w - 553, $h - 78, "____________________________________________________________________________________________________________________________________________________________________", $font, 6, array(0, 0, 0));
$canvas->page_text($w - 550, $h - 70, "El Instituto Nacional de Investigaciones Agrícolas, antes FONAIAP,  es un instituto autónomo adscrito al Ministerio del Poder Popular para la Agricultura y Tierras,  dedicado a la investigación científica", $font, 6, array(0, 0, 0));
$canvas->page_text($w - 530, $h - 63, " agrícola, desarrollo tecnológico, asesoramiento y prestación de servicios especializados.  Dirección: Presidencia: Av. Universidad. Esquina El Chorro. Torre MCT. Piso 08. La Hoyada. Caracas -", $font, 6, array(0, 0, 0));
$canvas->page_text($w - 530, $h - 56, "Venezuela. Teléfonos (58 212) 5646466 - 5640355 - 5643862. Fax (58 212) 2103681.  Gerencia General: Av. Universidad, vía El Limón, Maracay, Estado Aragua, Teléfonos (58 243) 2404911 -", $font, 6, array(0, 0, 0));
$canvas->page_text($w - 500, $h - 49, " 2404642 - 2404772 – 2404762. Fax (58 243) 2404732. INIA Mérida: Av Urdaneta Edif. INIA-Mérida, Mérida estado Mérida. Telefax: (58 274) 2630090 / 2637941 ", $font, 6, array(0, 0, 0));
$canvas->close_object();
$canvas->add_object($footer, "all");
$dompdf->PDF::loadView("ejemplo.php", array("Attachment" => 0));
开发者ID:jorgcastellano,项目名称:inia,代码行数:31,代码来源:ejemplo1.php

示例6: DOMPDF

            $html .= '	<td>' . $categoria->obtener('CATEGORIA') . ' (' . $programa->obtener('PROGRAMA') . ')</td>
									<td>' . $detalle->obtener('OBSERVACIONES') . '</td>
								</tr>
						';
            $d = $rvd->releer();
        }
        $r = $detalle->releer();
    }
    $html .= '
				</table>
			</div>
			';
}
$html .= '	
	</body>
</html>';
require_once "./mvc/modelo/dompdf_config.inc.php";
$dompdf = new DOMPDF();
$dompdf->set_paper('A4', 'landscape');
//portrait
$dompdf->load_html(utf8_encode($html));
$dompdf->render();
$canvas = $dompdf->get_canvas();
$font = Font_Metrics::get_font("helvetica", "bold");
$canvas->page_text(16, 800, "Pag: {PAGE_NUM}/{PAGE_COUNT}", $font, 8, array(0, 0, 0));
$filename = "" . $archivofinal . ".pdf";
if ($_GET['imprimir']) {
    $dompdf->stream($filename, array("Attachment" => 0));
} else {
    $dompdf->stream($filename);
}
开发者ID:EdgardoPitti,项目名称:cuidadospaliativos,代码行数:31,代码来源:datospdf.php

示例7: DOMPDF

        } else {
            $settings[] = 'arial';
            $settings[] = 'bold';
            $settings[] = '11';
            $settings[] = '500';
            $settings[] = '795';
            $settings[] = '0:0:0';
        }
        if (!$settings[5]) {
            $settings[5] = '0:0:0';
        }
        $dompdf = new DOMPDF();
        $dompdf->set_paper('A4');
        $dompdf->load_html($content, 'UTF-8');
        $dompdf->render();
        // ADD PAGE NUMBER IN FOOTER
        $canvas = $dompdf->get_canvas();
        $font = Font_Metrics::get_font($settings[0], $settings[1]);
        $canvas->page_text($settings[3], $settings[4], $this->pi_getLL('page', 'page') . ' {PAGE_NUM} ' . $this->pi_getLL('of', 'of') . ' {PAGE_COUNT}', $font, $settings[2], explode(':', $settings[5]));
        // SAVE AS FILE
        if ($this->get['tx_multishop_pi1']['forceRecreate'] && file_exists($pdfFilePath)) {
            unlink($pdfFilePath);
        }
        file_put_contents($pdfFilePath, $dompdf->output(array('compress' => 0)));
    }
}
if (file_exists($pdfFilePath)) {
    header("Content-type:application/pdf");
    readfile($pdfFilePath);
}
exit;
开发者ID:bvbmedia,项目名称:multishop,代码行数:31,代码来源:download_packingslip.php

示例8: create

 /**
  * Create PDF
  *
  * @access	public
  * @return	void
  */
 function create($mode = 'download')
 {
     if (is_null($this->html)) {
         show_error("HTML is not set");
     }
     if (is_null($this->path)) {
         show_error("Path is not set");
     }
     if (is_null($this->paper_size)) {
         show_error("Paper size not set");
     }
     if (is_null($this->orientation)) {
         show_error("Orientation not set");
     }
     //Load the DOMPDF libary
     require_once "dompdf/dompdf_config.inc.php";
     $dompdf = new DOMPDF();
     $dompdf->load_html($this->html);
     $dompdf->set_paper($this->paper_size, $this->orientation);
     $dompdf->render();
     $canvas = $dompdf->get_canvas();
     $font = Font_Metrics::get_font("helvetica", "bold");
     $canvas->page_text(380, 570, "Página {PAGE_NUM} de {PAGE_COUNT}", $font, 8, array(0, 0, 0));
     if ($mode == 'save') {
         $this->CI->load->helper('file');
         if (write_file($this->path . $this->filename, $dompdf->output())) {
             return $this->path . $this->filename;
         } else {
             show_error("PDF could not be written to the path");
         }
     } else {
         if ($dompdf->stream($this->filename)) {
             return TRUE;
         } else {
             show_error("PDF could not be streamed");
         }
     }
 }
开发者ID:jeaninnoweb,项目名称:Proyecto_n01,代码行数:44,代码来源:html2pdf.php

示例9: ob_get_clean

</tr>

</table>
<br> 
<p style="text-align: left; width:49%; display: inline-block;"><font size="2">Verified By<br>&nbsp;&nbsp; DT001</font> </p>
<p style="text-align: right; width:40%;  display: inline-block;"><font size="2">Approved By<br><font style="margin-right:20px;"> NC007</font> </font></p>
 

</div>
</font>
<br><br>
</div>


</body>
</html>

<?php 
$htmlcontent = ob_get_clean();
include "dompdf/dompdf_config.inc.php";
$htmlcontent = stripslashes($htmlcontent);
$dompdf = new DOMPDF();
$dompdf->load_html($htmlcontent);
$dompdf->set_paper("folio", "portrait");
$dompdf->render();
$canvas = $dompdf->get_canvas();
$font = Font_Metrics::get_font("", "bold");
$canvas->page_text(50, 850, "", $font, 7, array(0, 0, 0));
$canvas->page_text(500, 850, "PAGE: {PAGE_NUM} OF {PAGE_COUNT}", $font, 8, array(0, 0, 0));
$dompdf->stream($filename, array("Attachment" => false));
exit(0);
开发者ID:snehakumavat,项目名称:thar,代码行数:31,代码来源:po_doc.php

示例10: get_font_family

 function get_font_family()
 {
     $DEBUGCSS = DEBUGCSS;
     $weight = $this->__get("font_weight");
     if (is_numeric($weight)) {
         if ($weight < 600) {
             $weight = "normal";
         } else {
             $weight = "bold";
         }
     } else {
         if ($weight === "bold" || $weight === "bolder") {
             $weight = "bold";
         } else {
             $weight = "normal";
         }
     }
     $font_style = $this->__get("font_style");
     if ($weight === "bold" && ($font_style === "italic" || $font_style === "oblique")) {
         $subtype = "bold_italic";
     } else {
         if ($weight === "bold" && $font_style !== "italic" && $font_style !== "oblique") {
             $subtype = "bold";
         } else {
             if ($weight !== "bold" && ($font_style === "italic" || $font_style === "oblique")) {
                 $subtype = "italic";
             } else {
                 $subtype = "normal";
             }
         }
     }
     if ($DEBUGCSS) {
         print "<pre>[get_font_family:";
         print '(' . $this->_props["font_family"] . '.' . $font_style . '.' . $this->__get("font_weight") . '.' . $weight . '.' . $subtype . ')';
     }
     $families = explode(",", $this->_props["font_family"]);
     $families = array_map('trim', $families);
     reset($families);
     $font = null;
     while (current($families)) {
         list(, $family) = each($families);
         $family = trim($family, " \t\n\r\v\"'");
         if ($DEBUGCSS) {
             print '(' . $family . ')';
         }
         $font = Font_Metrics::get_font($family, $subtype);
         if ($font) {
             if ($DEBUGCSS) {
                 print '(' . $font . ")get_font_family]\n</pre>";
             }
             return $font;
         }
     }
     $family = null;
     if ($DEBUGCSS) {
         print '(default)';
     }
     $font = Font_Metrics::get_font($family, $subtype);
     if ($font) {
         if ($DEBUGCSS) {
             print '(' . $font . ")get_font_family]\n</pre>";
         }
         return $font;
     }
     throw new DOMPDF_Exception("Unable to find a suitable font replacement for: '" . $this->_props["font_family"] . "'");
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:66,代码来源:style.cls.php

示例11: pdf_create

 function pdf_create($html, $filename = '', $stream = FALSE)
 {
     require_once APPPATH . "third-party/dompdf_config.inc.php";
     //Require Loader Class n Config
     spl_autoload_register('DOMPDF_autoload');
     //Autoload Resource
     ini_set("memory_limit", "999M");
     ini_set("max_execution_time", "999");
     $dompdf = new DOMPDF();
     //Instansiasi
     $dompdf->load_html($html);
     //Load HTML File untuk dirender
     //   $dompdf->set_base_path(realpath($css));
     $dompdf->set_paper(array(0, 0, 8.5 * 72, 13.5 * 72), "portrait");
     //array(0,0, 8.5 * 72, 11 * 72)
     $dompdf->render();
     //Proses Rendering File
     $canvas = $dompdf->get_canvas();
     $font = Font_Metrics::get_font("helvetica", "bold");
     $canvas->page_text(830, 578, "Halaman: {PAGE_NUM} dari {PAGE_COUNT}", $font, 8, array(0, 0, 0));
     if ($stream == TRUE) {
         $dompdf->stream($filename, array('Attachment' => 0));
     } else {
         $CI =& get_instance();
         $CI->load->helper('file');
         write_file($filename, $dompdf->output());
         //file name adalah ABSOLUTE PATH dari tempat menyimpan file PDF
     }
 }
开发者ID:ibnoe,项目名称:dms,代码行数:29,代码来源:Pdf.php

示例12: render

 /**
  * Effectue le rendu du contenu html en pdf
  * 
  * @return void
  */
 function render()
 {
     $this->dompdf->load_html($this->html);
     $this->dompdf->render();
     if (CHtmlToPDFConverter::$_page_ordonnance) {
         $this->dompdf->get_canvas()->page_text(273, 730, "Page {PAGE_NUM} / {PAGE_COUNT}", Font_Metrics::get_font("arial"), 10);
     }
     $this->result = $this->dompdf->output();
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:14,代码来源:CDomPDFConverter.class.php


注:本文中的Font_Metrics::get_font方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。