本文整理汇总了PHP中pdf_lineto函数的典型用法代码示例。如果您正苦于以下问题:PHP pdf_lineto函数的具体用法?PHP pdf_lineto怎么用?PHP pdf_lineto使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pdf_lineto函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawPie
function drawPie($centerX, $centerY, $radius, $begin, $end, $style)
{
$this->_convertPosition($centerX, $centerY);
$radius = $radius * min($this->width, $this->height);
pdf_setcolor($this->pdf, 'stroke', $style['line'][0], $style['line'][1], $style['line'][2], $style['line'][3], $style['line'][4]);
if (isset($style['fill'])) {
pdf_setcolor($this->pdf, 'fill', $style['fill'][0], $style['fill'][1], $style['fill'][2], $style['fill'][3], $style['fill'][4]);
}
pdf_setlinewidth($this->pdf, $style['line-width']);
pdf_moveto($this->pdf, $centerX, $centerY);
pdf_arc($this->pdf, $centerX, $centerY, $radius, $begin, $end);
pdf_lineto($this->pdf, $centerX, $centerY);
if (isset($style['fill'])) {
pdf_closepath_fill_stroke($this->pdf);
} else {
pdf_closepath_stroke($this->pdf);
}
}
示例2: lineto
function lineto($x, $y)
{
pdf_lineto($this->pdf, $x, $y);
}
示例3: polygon
/**
* Parameter array:
* 'connect': bool [optional] Specifies whether the start point should be
* connected to the endpoint (closed polygon) or not (connected line)
* 'fill': mixed [optional] The fill color
* 'line': mixed [optional] The line color
* @param array $params Parameter array
*/
function polygon($params = array())
{
$connectEnds = isset($params['connect']) ? $params['connect'] : false;
$fillColor = isset($params['fill']) ? $params['line'] : false;
$lineColor = isset($params['line']) ? $params['line'] : false;
$line = $this->_setLineStyle($lineColor);
$fill = false;
if ($connectEnds) {
$fill = $this->_setFillStyle($fillColor);
}
$first = true;
foreach ($this->_polygon as $point) {
if ($first === true) {
pdf_moveto($this->_pdf, $point['X'], $point['Y']);
$first = $point;
} else {
if (isset($last['P1X'])) {
pdf_curveto($this->_pdf, $last['P1X'], $last['P1Y'], $last['P2X'], $last['P2Y'], $point['X'], $point['Y']);
} else {
pdf_lineto($this->_pdf, $point['X'], $point['Y']);
}
}
$last = $point;
}
if ($connectEnds) {
if (isset($last['P1X'])) {
pdf_curveto($this->_pdf, $last['P1X'], $last['P1Y'], $last['P2X'], $last['P2Y'], $first['X'], $first['Y']);
} else {
pdf_lineto($this->_pdf, $first['X'], $first['Y']);
}
}
if ($line && $fill) {
pdf_fill_stroke($this->_pdf);
} elseif ($line) {
pdf_stroke($this->_pdf);
} elseif ($fill) {
pdf_fill($this->_pdf);
}
parent::polygon($params);
}
示例4: PDF_new
<?php
$p = PDF_new();
PDF_open_file($p);
$im = pdf_open_jpeg($p, "php-big.jpg");
$template = pdf_begin_template($p, 595, 842);
pdf_save($p);
pdf_place_image($p, $im, 4, 803, 0.25);
pdf_place_image($p, $im, 525, 803, 0.25);
pdf_moveto($p, 0, 795);
pdf_lineto($p, 595, 795);
pdf_stroke($p);
$font = PDF_findfont($p, "Times-Bold", "host", 0);
PDF_setfont($p, $font, 38.0);
pdf_show_xy($p, "PDF Template Example", 100, 807);
pdf_restore($p);
pdf_end_template($p);
pdf_close_image($p, $im);
PDF_begin_page($p, 595, 842);
pdf_place_image($p, $template, 0, 0, 1.0);
PDF_end_page($p);
PDF_begin_page($p, 595, 842);
pdf_place_image($p, $template, 0, 0, 1.0);
PDF_end_page($p);
PDF_close($p);
$buf = PDF_get_buffer($p);
$len = strlen($buf);
Header("Content-type:application/pdf");
Header("Content-Length:{$len}");
Header("Content-Disposition:inline; filename=gra2.pdf");
echo $buf;
示例5: pdf_save
/* draw minute hand */
pdf_save($pdf);
pdf_rotate($pdf, -($ltime['seconds'] / 60.0 + $ltime['minutes'] - 15.0) * 6.0);
pdf_moveto($pdf, -$radius / 10, -$radius / 20);
pdf_lineto($pdf, $radius * 0.8, 0.0);
pdf_lineto($pdf, -$radius / 10, $radius / 20);
pdf_closepath($pdf);
pdf_fill($pdf);
pdf_restore($pdf);
/* draw second hand */
pdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
pdf_setlinewidth($pdf, 2);
pdf_save($pdf);
pdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
pdf_moveto($pdf, -$radius / 5, 0.0);
pdf_lineto($pdf, $radius, 0.0);
pdf_stroke($pdf);
pdf_restore($pdf);
/* draw little circle at center */
pdf_circle($pdf, 0, 0, $radius / 30);
pdf_fill($pdf);
pdf_restore($pdf);
/* DONE */
pdf_end_page($pdf);
pdf_close($pdf);
pdf_delete($pdf);
// hides "Generating ..." message:
echo "<script language='JavaScript'>document.getElementById('loading').style.display = 'none';</script>";
if (!file_exists($file)) {
?>
<h2 style="color: red">Error occured: file <?php
示例6: _slide
function _slide(&$slide)
{
global $pres;
$currentPres = $_SESSION['currentPres'];
$p = $this->objs[1];
$middle = (int) ($this->pdf_y / 2) - 40;
$this->pdf_cy = 25;
// top-margin
$this->pdf_cx = 40;
if ($this->objs[1]->template == 'titlepage') {
$p = $pres;
$loc = $middle - 80 * (!empty($p->title) + !empty($p->event) + !empty($p->date) + (!empty($p->speaker) || !empty($p->email)) + !empty($p->url) + !empty($p->subtitle)) / 2;
if (!empty($p->title)) {
pdf_set_font($this->pdf, $this->pdf_font, -36, 'winansi');
pdf_show_boxed($this->pdf, $p->title, 10, $loc, $this->pdf_x - 20, 40, 'center', null);
}
if (!empty($p->subtitle)) {
$loc += 50;
pdf_set_font($this->pdf, $this->pdf_font, -22, 'winansi');
pdf_show_boxed($this->pdf, $p->subtitle, 10, $loc, $this->pdf_x - 20, 40, 'center', null);
}
if (!empty($p->event)) {
$loc += 80;
pdf_set_font($this->pdf, $this->pdf_font, -30, 'winansi');
pdf_show_boxed($this->pdf, $p->event, 10, $loc, $this->pdf_x - 20, 40, 'center', null);
}
if (!empty($p->date) && !empty($p->location)) {
$loc += 80;
pdf_set_font($this->pdf, $this->pdf_font, -30, 'winansi');
pdf_show_boxed($this->pdf, $p->date . '. ' . $p->location, 10, $loc, $this->pdf_x - 20, 40, 'center', null);
} else {
if (!empty($p->date)) {
$loc += 80;
pdf_set_font($this->pdf, $this->pdf_font, -30, 'winansi');
pdf_show_boxed($this->pdf, $p->date, 10, $loc, $this->pdf_x - 20, 40, 'center', null);
} else {
if (!empty($p->location)) {
$loc += 80;
pdf_set_font($this->pdf, $this->pdf_font, -30, 'winansi');
pdf_show_boxed($this->pdf, $p->location, 10, $loc, $this->pdf_x - 20, 40, 'center', null);
}
}
}
if (!empty($p->speaker) && !empty($p->email)) {
$loc += 80;
pdf_set_font($this->pdf, $this->pdf_font, -30, 'winansi');
pdf_show_boxed($this->pdf, $p->speaker . ' <' . $p->email . '>', 10, $loc, $this->pdf_x - 20, 40, 'center', null);
} else {
if (!empty($p->speaker)) {
$loc += 80;
pdf_set_font($this->pdf, $this->pdf_font, -30, 'winansi');
pdf_show_boxed($this->pdf, $p->speaker, 10, $loc, $this->pdf_x - 20, 40, 'center', null);
} else {
if (!empty($p->email)) {
$loc += 80;
pdf_set_font($this->pdf, $this->pdf_font, -30, 'winansi');
pdf_show_boxed($this->pdf, ' <' . $p->email . '>', 10, $loc, $this->pdf_x - 20, 40, 'center', null);
}
}
}
if (!empty($p->url)) {
$loc += 80;
pdf_set_font($this->pdf, $this->pdf_font, -30, 'winansi');
pdf_show_boxed($this->pdf, $p->url, 10, $loc, $this->pdf_x - 20, 40, 'center', null);
}
if (!empty($p->copyright)) {
pdf_moveto($this->pdf, 60, $this->pdf_y - 60);
pdf_lineto($this->pdf, $this->pdf_x - 60, $this->pdf_y - 60);
pdf_stroke($this->pdf);
pdf_set_font($this->pdf, $this->pdf_font, -10, 'winansi');
$fnt = pdf_findfont($this->pdf, $this->pdf_font, 'winansi', 0);
$x = (int) ($this->pdf_x / 2 - pdf_stringwidth($this->pdf, $p->copyright, $fnt, -10) / 2);
$str = str_replace('(c)', chr(0xa9), $p->copyright);
$str = str_replace('(R)', chr(0xae), $str);
pdf_show_xy($this->pdf, $str, $x, $this->pdf_y - 45);
}
$this->page_index[$this->page_number] = 'titlepage';
} else {
// No header on the title page
pdf_set_font($this->pdf, $this->pdf_font, -12, 'winansi');
$fnt = pdf_findfont($this->pdf, $this->pdf_font, 'winansi', 0);
pdf_show_boxed($this->pdf, "Slide {$this->slideNum}/{$this->maxSlideNum}", $this->pdf_cx, $this->pdf_cy, $this->pdf_x - 2 * $this->pdf_cx, 1, 'left', null);
if (isset($p->date)) {
$this->d = $this->date;
} else {
$this->d = strftime("%B %e %Y");
}
$w = pdf_stringwidth($this->pdf, $this->d, $fnt, -12);
pdf_show_boxed($this->pdf, $this->d, 40, $this->pdf_cy, $this->pdf_x - 2 * $this->pdf_cx, 1, 'right', null);
pdf_set_font($this->pdf, $this->pdf_font, -24, 'winansi');
pdf_show_boxed($this->pdf, strip_markups($slide->title), 40, $this->pdf_cy, $this->pdf_x - 2 * $this->pdf_cx, 1, 'center', null);
$this->page_index[$this->page_number] = strip_markups($slide->title);
}
$this->pdf_cy += 30;
if ($this->slideNum) {
pdf_moveto($this->pdf, 40, $this->pdf_cy);
pdf_lineto($this->pdf, $this->pdf_x - 40, $this->pdf_cy);
pdf_stroke($this->pdf);
}
$this->pdf_cy += 20;
//.........这里部分代码省略.........
示例7: pdf_moveto
pdf_moveto($pdf, 0, -1);
pdf_lineto($pdf, 0, -11);
pdf_moveto($pdf, 121, -1);
pdf_lineto($pdf, 121, -11);
pdf_moveto($pdf, 0, 121);
pdf_lineto($pdf, 0, 131);
pdf_moveto($pdf, 121, 121);
pdf_lineto($pdf, 121, 131);
pdf_moveto($pdf, -1, 0);
pdf_lineto($pdf, -11, 0);
pdf_moveto($pdf, -1, 120);
pdf_lineto($pdf, -11, 120);
pdf_moveto($pdf, 122, 0);
pdf_lineto($pdf, 132, 0);
pdf_moveto($pdf, 122, 120);
pdf_lineto($pdf, 132, 120);
pdf_stroke($pdf);
if ($bitmap['front_resolution'] >= $cfg['image_front_cover_treshold']) {
$pdfdfimage = pdf_load_image($pdf, 'auto', $cfg['media_dir'] . $bitmap['image_front'], '');
pdf_fit_image($pdf, $pdfdfimage, 0, 0, 'boxsize {121 120} position {50 50} fitmethod slice');
$hash_data .= '-' . filesize($cfg['media_dir'] . $bitmap['image_front']) . '-' . filemtime($cfg['media_dir'] . $bitmap['image_front']);
}
// +------------------------------------------------------------------------+
// | Close and download PDF |
// +------------------------------------------------------------------------+
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
pdf_delete($pdf);
$filename = $album['artist'] . ' - ' . $album['album'] . '.pdf';
$filename = downloadFilename($filename);
示例8: while
$i = 0;
while ($y - $offset > 80) {
pdf_setcolor($pdf, 'fill', 'gray', $i % 2 ? 0.8 : 1, 0, 0, 0);
pdf_setcolor($pdf, 'stroke', 'gray', $i % 2 ? 0.8 : 1, 0, 0, 0);
pdf_rect($pdf, 21, $y - $offset, $x - 42, 24);
pdf_fill_stroke($pdf);
$i++;
$offset += 24;
}
pdf_setcolor($pdf, 'fill', 'gray', 0, 0, 0, 0);
pdf_setcolor($pdf, 'stroke', 'gray', 0, 0, 0, 0);
pdf_moveto($pdf, 20, $y - 160);
pdf_lineto($pdf, $x - 20, $y - 160);
pdf_stroke($pdf);
pdf_moveto($pdf, $x - 140, $y - 160);
pdf_lineto($pdf, $x - 140, 80);
pdf_stroke($pdf);
pdf_set_font($pdf, "Times-Bold", 18, winansi);
pdf_show_xy($pdf, "Articulo", 30, $y - 150);
pdf_show_xy($pdf, "Precio", $x - 100, $y - 150);
pdf_set_font($pdf, "Times-Italic", 15, winansi);
$offset = 177;
foreach ($items as $item) {
pdf_show_xy($pdf, $item[0], 30, $y - $offset);
pdf_show_boxed($pdf, '$' . number_format($item[1], 2), $x - 55, $y - $offset, 0, 0, 'right');
$offset += 24;
$total += $item[1];
}
pdf_set_font($pdf, "Times-Bold", 17, winansi);
$offset += 24;
pdf_show_xy($pdf, 'Total', 30, $y - $offset);
示例9: pdf_new
# a simple bar graph
// create a new pdf document
$pdf = pdf_new();
$filename = 'c:pdf_example4.pdf';
pdf_open_file($pdf, $filename);
// start a new page (Letter size)
pdf_begin_page($pdf, 612, 792);
// setup font and print hello world
pdf_set_parameter($pdf, 'FontOutline', 'Arial=c:windowsfontsarial.ttf');
$font = pdf_findfont($pdf, "Arial", "host", 1);
pdf_setfont($pdf, $font, 16);
pdf_show_xy($pdf, "Simple Bar Graph", 50, 720);
// draw the x and y axis
pdf_moveto($pdf, 50, 690);
pdf_lineto($pdf, 50, 520);
pdf_lineto($pdf, 400, 520);
pdf_stroke($pdf);
// draw the bar chart
$x = 80;
$y = 520;
$w = 40;
// 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);
示例10: end_message
function end_message()
{
$y = pdf_get_value($this->pdf, 'texty', 0) - 10;
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 - 20);
}
示例11: draw_star
function draw_star($centerx, $centery, $points, $radius, $point_size, $pdf, $filled)
{
$inner_radius = $radius - $point_size;
for ($i = 0; $i <= $points * 2; $i++) {
$angle = $i * 2 * pi() / ($points * 2);
if ($i % 2) {
$x = $radius * cos($angle) + $centerx;
$y = $radius * sin($angle) + $centery;
} else {
$x = $inner_radius * cos($angle) + $centerx;
$y = $inner_radius * sin($angle) + $centery;
}
if ($i == 0) {
pdf_moveto($pdf, $x, $y);
} else {
if ($i == $points * 2) {
pdf_closepath($pdf);
} else {
pdf_lineto($pdf, $x, $y);
}
}
}
if ($filled) {
pdf_fill_stroke($pdf);
} else {
pdf_stroke($pdf);
}
}
示例12: pdf_setfont
// 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));
echo $data;