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


PHP pdf_setfont函数代码示例

本文整理汇总了PHP中pdf_setfont函数的典型用法代码示例。如果您正苦于以下问题:PHP pdf_setfont函数的具体用法?PHP pdf_setfont怎么用?PHP pdf_setfont使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: pdf_set_font

 function pdf_set_font($pdf, $font_name, $fs, $encoding)
 {
     $font = pdf_findfont($pdf, $font_name, $encoding, 0);
     if ($font) {
         return pdf_setfont($pdf, $font, $fs);
     }
     return false;
 }
开发者ID:rickogden,项目名称:web-pres2,代码行数:8,代码来源:display.php

示例2: center

function center($s, $y, $size, $fontname = "Times-Roman", $outline = 0)
{
    global $pdf, $font, $width;
    pdf_set_value($pdf, "textrendering", $outline);
    $font = pdf_findfont($pdf, $fontname, "iso8859-2");
    pdf_setfont($pdf, $font, $size);
    $w = pdf_stringwidth($pdf, $s);
    pdf_show_xy($pdf, $s, ($width - $w) / 2, $y);
}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:9,代码来源:clock.php

示例3: drawText

 function drawText($text, $left, $right, $height, $style)
 {
     $h = $height;
     // Creating duplicate (temp)
     $this->_convertPosition($left, $height);
     $this->_convertPosition($right, $h);
     pdf_setcolor($this->pdf, 'fill', $style['fill'][0], $style['fill'][1], $style['fill'][2], $style['fill'][3], $style['fill'][4]);
     pdf_setfont($this->pdf, $this->font, $style['font']);
     pdf_show_boxed($this->pdf, $text, $left, $height - $style['font'], $right - $left, $style['font'], $style['align'], '');
 }
开发者ID:noikiy,项目名称:owaspbwa,代码行数:10,代码来源:pdflib.php

示例4: _show_watermark

 function _show_watermark($watermark)
 {
     $font = $this->findfont('Helvetica', 'iso-8859-1');
     pdf_setfont($this->pdf, $font, 100);
     $x = $this->left + $this->width / 2;
     $y = $this->bottom + $this->height / 2 + $this->offset;
     pdf_set_value($this->pdf, "textrendering", 1);
     pdf_translate($this->pdf, $x, $y);
     pdf_rotate($this->pdf, 60);
     pdf_show_xy($this->pdf, $watermark, -pdf_stringwidth($this->pdf, $watermark, $font, 100) / 2, -50);
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:11,代码来源:output.pdflib.class.php

示例5: _setFont

 /**
  * Set the PDF font
  *
  * @access private
  */
 function _setFont()
 {
     $this->_pdfFont = false;
     if (isset($this->_font['name'])) {
         pdf_set_parameter($this->_pdf, 'FontOutline', $this->_font['name'] . '=' . $this->_font['file']);
         $this->_pdfFont = pdf_findfont($this->_pdf, $this->_font['name'], $this->_font['encoding'], 1);
         if ($this->_pdfFont) {
             pdf_setfont($this->_pdf, $this->_pdfFont, $this->_font['size']);
             $this->_setFillStyle($this->_font['color']);
         }
     } else {
         $this->_setFillStyle('black');
     }
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:19,代码来源:PDF.php

示例6: _show_watermark

 function _show_watermark()
 {
     if (is_null($this->_watermark) || $this->_watermark == "") {
         return;
     }
     $font = $this->_control_font();
     pdf_setfont($this->pdf, $font, 100);
     $x = $this->left + $this->width / 2;
     $y = $this->bottom + $this->height / 2 + $this->offset;
     pdf_set_value($this->pdf, "textrendering", 1);
     pdf_translate($this->pdf, $x, $y);
     pdf_rotate($this->pdf, 60);
     pdf_show_xy($this->pdf, $this->_watermark, -pdf_stringwidth($this->pdf, $this->_watermark, $font, 100) / 2, -50);
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:14,代码来源:output.pdflib.class.php

示例7: fopen

<?php

//create file
$fp = fopen('hello.pdf', 'w');
if (!$fp) {
    echo "Error: could not create the PDF file";
    exit;
}
// start the pdf document
$pdf = pdf_open($fp);
pdf_set_info($pdf, "Creator", "pdftest.php");
pdf_set_info($pdf, "Author", "Luke Welling and Laura Thomson");
pdf_set_info($pdf, "Title", "Hello World (PHP)");
// US letter is 11" x 8.5" and there are 72 points per inch
pdf_begin_page($pdf, 8.5 * 72, 11 * 72);
pdf_add_outline($pdf, 'Page 1');
$font = pdf_findfont($pdf, 'Times-Roman', 'host', 0);
pdf_setfont($pdf, $font, 24);
pdf_set_text_pos($pdf, 50, 700);
// write text
pdf_show($pdf, 'Hello,world!');
pdf_continue_text($pdf, '(says PHP)');
// end the document
pdf_end_page($pdf);
pdf_close($pdf);
fclose($fp);
// display a link to download
echo "download the pdf <a href = 'hello.pdf'>here</a>";
?>
    
开发者ID:kmfb21,项目名称:A290CGI-PHP,代码行数:29,代码来源:testpdf.php

示例8: pdf_setfont

         $text .= $track['artist'] . ' - ' . $track['title'] . "\n";
     }
     $previous_disc = $track['disc'];
 }
 // $text = iconv(NJB_DEFAULT_CHARSET, 'UTF-8', $text);
 pdf_setfont($pdf, $font, 3);
 pdf_show_boxed($pdf, $text, 6.5, 0, 138, 108, 'center', '');
 $query = mysql_query('SELECT artist, album FROM album WHERE album_id = "' . mysql_real_escape_string($album_id) . '"');
 $album = mysql_fetch_assoc($query);
 if (in_array(strtolower($album['artist']), $cfg['no_album_artist'])) {
     $title = $album['album'];
 } else {
     $title = $album['artist'] . ' - ' . $album['album'];
 }
 // $title = iconv(NJB_DEFAULT_CHARSET, 'UTF-8', $title);
 pdf_setfont($pdf, $font, 4);
 pdf_save($pdf);
 pdf_rotate($pdf, 90);
 pdf_set_text_pos($pdf, 2, -4.5);
 // y, -x
 pdf_show($pdf, $title);
 pdf_restore($pdf);
 // Restore rotate
 pdf_save($pdf);
 pdf_rotate($pdf, -90);
 pdf_set_text_pos($pdf, -116, 151 - 4.5);
 // -y, x
 pdf_show($pdf, $title);
 pdf_restore($pdf);
 // Restore rotate
 $hash_data .= '-' . $text . '-' . $title;
开发者ID:jdeblese,项目名称:ompd-mod,代码行数:31,代码来源:cover.php

示例9: pdf_new

<?php

// create handle for new PDF document
$pdf = pdf_new();
// open a file
pdf_open_file($pdf, "philosophy.pdf");
// start a new page (A4)
pdf_begin_page($pdf, 595, 842);
// get and use a font object
$arial = pdf_findfont($pdf, "Arial", "host", 1);
pdf_setfont($pdf, $arial, 10);
// print text
pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,", 50, 750);
pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50, 730);
// end page
pdf_end_page($pdf);
// close and save file
pdf_close($pdf);
开发者ID:aedvalson,项目名称:Nexus,代码行数:18,代码来源:pdflibtest.php

示例10: array

// the data and color for each column
$data = array('120', '160', '300', '240');
$color = array('#4EC3BC', '#DAA876', '#E29CC8', '#FDE0C6');
// get into some meat now, cheese for vegetarians;
for ($i = 0; $i < count($data); $i++) {
    // calculate the height of the bar
    $y_ht = $data[$i] / max($data) * 100;
    // set the color for each bar
    list($r, $g, $b) = hex2rgb($color[$i]);
    pdf_setcolor($pdf, "fill", "rgb", $r, $g, $b, 0);
    // draw the bar
    pdf_rect($pdf, $x, $y, $w, $y_ht);
    pdf_fill_stroke($pdf);
    // write the bar label
    pdf_setcolor($pdf, "fill", "rgb", 0, 0, 0, 0);
    pdf_setfont($pdf, $font, 10);
    pdf_show_xy($pdf, $data[$i], $x + 12, $y - 16);
    // go to the next bar
    $x = $x + $w + 40;
}
// done
pdf_end_page($pdf);
pdf_close($pdf);
pdf_delete($pdf);
// send it to browser
header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=pdf_example3.pdf");
readfile($filename);
unlink($filename);
// function to convert a standard rgb from hex to float
function hex2rgb($hex)
开发者ID:OmondiKevin,项目名称:CD4,代码行数:31,代码来源:interview_Report.php

示例11: define

<?php

define('PAGE_WIDTH', 612);
define('PAGE_HEIGHT', 792);
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_begin_page($pdf, PAGE_WIDTH, PAGE_HEIGHT);
$font = pdf_findfont($pdf, "Helvetica", "auto", false);
pdf_setfont($pdf, $font, 30);
pdf_show_xy($pdf, "PHP Developer's Handbook", 10, PAGE_HEIGHT - 40);
pdf_setfont($pdf, $font, 12);
pdf_show_xy($pdf, "Hello, World! Using PDFLib and PHP", 10, PAGE_HEIGHT - 55);
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header('Content-type: application/pdf');
header("Content-disposition: inline; filename=output.pdf");
header("Content-length: " . strlen($data));
echo $data;
开发者ID:SandyS1,项目名称:presentations,代码行数:19,代码来源:hello.php

示例12: message_header

 function message_header($subject, $author, $date, $id, $th)
 {
     $y = pdf_get_value($this->pdf, 'texty', 0) - 3;
     if ($y < 100) {
         $this->end_page();
         $this->begin_page($this->pg_title);
         $y = $this->ph - $this->hmargin;
     }
     pdf_moveto($this->pdf, $this->wmargin, $y);
     pdf_lineto($this->pdf, $this->pw - $this->wmargin, $y);
     pdf_moveto($this->pdf, $this->wmargin, $y - 3);
     pdf_lineto($this->pdf, $this->pw - $this->wmargin, $y - 3);
     pdf_stroke($this->pdf);
     pdf_set_text_pos($this->pdf, $this->wmargin, $y - 5);
     pdf_setfont($this->pdf, $this->fonts['Helvetica'], 14);
     pdf_continue_text($this->pdf, 'Subject: ' . $subject);
     pdf_continue_text($this->pdf, 'Posted by ' . $author . ' on ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $date));
     pdf_continue_text($this->pdf, 'URL: ');
     $url = $GLOBALS['WWW_ROOT'] . '?t=rview&th=' . $th . '&goto=' . $id;
     $this->add_link($url, $url);
     $this->draw_line();
     pdf_set_text_pos($this->pdf, $this->wmargin, $this->y - 3);
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:23,代码来源:pdf.php

示例13: pdf_setfont

 if ($font) {
     pdf_setfont($pdf, $font, 48);
 }
 $startx = ($width - pdf_stringwidth($pdf, 'PHP Certification', $font, '12')) / 2;
 pdf_show_xy($pdf, 'PHP Certification', $startx, 490);
 // add text
 $font = pdf_findfont($pdf, $fontname, 'host', 0);
 if ($font) {
     pdf_setfont($pdf, $font, 26);
 }
 $startx = 70;
 pdf_show_xy($pdf, 'This is to certify that:', $startx, 430);
 pdf_show_xy($pdf, strtoupper($name), $startx + 90, 391);
 $font = pdf_findfont($pdf, $fontname, 'host', 0);
 if ($font) {
     pdf_setfont($pdf, $font, 20);
 }
 pdf_show_xy($pdf, 'has demonstrated that they are certifiable ' . 'by passing a rigorous exam', $startx, 340);
 pdf_show_xy($pdf, 'consisting of three multiple choice questions.', $startx, 310);
 pdf_show_xy($pdf, "{$name} obtained a score of {$score}" . '%.', $startx, 260);
 pdf_show_xy($pdf, 'The test was set and overseen by the ', $startx, 210);
 pdf_show_xy($pdf, 'Fictional Institute of PHP Certification', $startx, 180);
 pdf_show_xy($pdf, "on {$date}.", $startx, 150);
 pdf_show_xy($pdf, 'Authorised by:', $startx, 100);
 // add bitmap signature image
 $signature = pdf_load_image($pdf, 'png', '/Program Files/Apache Software Foundation/Apache2.2/htdocs/phpmysql4e/chapter33/signature.png', '');
 pdf_fit_image($pdf, $signature, 200, 75, '');
 pdf_close_image($pdf, $signature);
 // set up colors for ribbon
 pdf_setcolor($pdf, 'fill', 'rgb', 0, 0, 0.4, 0);
 // dark blue
开发者ID:kai-cn,项目名称:bookcode-php-mysql-web-development,代码行数:31,代码来源:pdflib.php

示例14: pdf_show_xy

    pdf_show_xy($pdf, "Attendance:", 50, 100);
    // Full Days Text //
    pdf_setfont($pdf, $body, 10);
    pdf_show_xy($pdf, "Full Days", 150, 100);
    // Full Days Text Above Line //
    pdf_setfont($pdf, $body, 10);
    pdf_show_xy($pdf, "{$full}", 125, 100);
    // Full Days Line //
    pdf_moveto($pdf, 110, 99);
    pdf_lineto($pdf, 145, 99);
    pdf_stroke($pdf);
    // Half Days Text //
    pdf_setfont($pdf, $body, 10);
    pdf_show_xy($pdf, "Half Days", 240, 100);
    // Half Days Text Above Line //
    pdf_setfont($pdf, $body, 10);
    pdf_show_xy($pdf, "{$half}", 215, 100);
    // Half Days Line //
    pdf_moveto($pdf, 200, 99);
    pdf_lineto($pdf, 235, 99);
    pdf_stroke($pdf);
    pdf_end_page($pdf);
}
//close it up
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
// Close up the db connection //
mysql_close($dbcnx);
header('Content-type: application/pdf');
header('Content-disposition: attachment; filename=ReportCard.pdf');
header('Content-length: ' . strlen($data));
开发者ID:rzs840707,项目名称:webapps_repository,代码行数:31,代码来源:ReportCards.php


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