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); }
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); }
function _bullet(&$bullet) { $type = ''; $this->pdf_cy = pdf_get_value($this->pdf, "texty", null); pdf_set_font($this->pdf, $this->pdf_font, -12, 'winansi'); $height = 10; $txt = strip_markups($bullet->text); pdf_save($this->pdf); pdf_translate($this->pdf, 0, $this->pdf_y); pdf_scale($this->pdf, 1, -1); pdf_set_font($this->pdf, $this->pdf_font, 12, 'winansi'); $leading = pdf_get_value($this->pdf, "leading", null); $inc = $leading; while (pdf_show_boxed($this->pdf, $txt, $this->pdf_cx + 30, $this->pdf_y - $this->pdf_cy, $this->pdf_x - 2 * ($this->pdf_cx + 20), $height, 'left', 'blind')) { $height += $inc; } pdf_restore($this->pdf); //clean up eols so we get a nice pdf output if (strstr($txt, "\r\n")) { $eol = "\r\n"; } elseif (strstr($txt, "\r")) { $eol = "\r"; } else { $eol = "\n"; } $txt = str_replace($eol, " ", $txt); $txt = str_replace(" ", " ", $txt); if ($this->pdf_cy + $height > $this->pdf_y - 40) { $this->my_pdf_page_number($this->pdf, $this->pdf_x, $this->pdf_y); $this->my_new_pdf_end_page($this->pdf); $this->my_new_pdf_page($this->pdf, $this->pdf_x, $this->pdf_y, true); $this->pdf_cx = 40; $this->pdf_cy = 60; } pdf_set_font($this->pdf, $this->pdf_font, -12, 'winansi'); if ($bullet->type == 'speaker') { pdf_setcolor($this->pdf, 'fill', 'rgb', 1, 0, 0, null); } if (!empty($bullet->start)) { if (is_numeric($bullet->start)) { $this->objs[$this->coid]->num = (int) $bullet->start; } else { $this->objs[$this->coid]->alpha = $bullet->start; } } if (!empty($bullet->type)) { $type = $bullet->type; } else { if (!empty($this->objs[$this->coid]->type)) { $type = $this->objs[$this->coid]->type; } } switch ($type) { case 'numbered': case 'number': case 'decimal': $symbol = ++$this->objs[$this->coid]->num . '.'; $pdf_cx_height = 30; break; case 'no-bullet': case 'none': $symbol = ''; $pdf_cx_height = 20; break; case 'alpha': $symbol = $this->objs[$this->coid]->alpha++ . '.'; break; case 'ALPHA': $symbol = strtoupper($this->objs[$this->coid]->alpha++) . '.'; $pdf_cx_height = 30; break; case 'asterisk': $symbol = '*'; $pdf_cx_height = 20; break; case 'hyphen': $symbol = '-'; $pdf_cx_height = 20; break; default: $symbol = 'o'; $pdf_cx_height = 20; break; } pdf_show_xy($this->pdf, $symbol, $this->pdf_cx + 20 + $bullet->level * 10, $this->pdf_cy + $leading - 1); pdf_show_boxed($this->pdf, $txt, $this->pdf_cx + 40 + $bullet->level * 10, $this->pdf_cy - $height, $this->pdf_x - 2 * ($this->pdf_cx + 20), $height, 'left', null); pdf_continue_text($this->pdf, "\n"); $this->pdf_cy = pdf_get_value($this->pdf, "texty", null); pdf_set_text_pos($this->pdf, $this->pdf_cx, $this->pdf_cy - $leading / 2); pdf_setcolor($this->pdf, 'fill', 'rgb', 0, 0, 0, null); }
pdf_begin_page($pdf, $width, $height); 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); } /* outlined */ center("It is {$texttime}.", $height - 60, 42, "Times-Roman", 1); center("It is time for", 200, 100, "Times-Roman", 1); /* filled */ center("Phalanger!", 70, 110, "Times-Bold", 0); pdf_translate($pdf, $radius + $margin, $radius + $margin + $footer); pdf_save($pdf); pdf_setrgbcolor($pdf, 0.0, 0.0, 1.0); /* minute strokes */ pdf_setlinewidth($pdf, 2.0); for ($alpha = 0; $alpha < 360; $alpha += 6) { pdf_rotate($pdf, 6.0); pdf_moveto($pdf, $radius, 0.0); pdf_lineto($pdf, $radius - $ring / 3, 0.0); pdf_stroke($pdf); } pdf_restore($pdf); pdf_save($pdf); /* 5 minute strokes */ pdf_setlinewidth($pdf, 3.0); for ($alpha = 0; $alpha < 360; $alpha += 30) {
// 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; } // +------------------------------------------------------------------------+ // | PDF front cover | // +------------------------------------------------------------------------+ $x0 = 44 - $x0; $y0 = 160 - $y0; pdf_translate($pdf, $x0, $y0); 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);