コード例 #1
0
ファイル: ps.php プロジェクト: noikiy/owaspbwa
 function drawText($text, $left, $right, $height, $style)
 {
     $h = $height;
     // Creating duplicate (temp)
     $this->_convertPosition($left, $height);
     $this->_convertPosition($right, $h);
     ps_setcolor($this->ps, 'fill', $style['fill'][0], $style['fill'][1], $style['fill'][2], $style['fill'][3], $style['fill'][4]);
     ps_setfont($this->ps, $this->font, $style['font']);
     ps_show_boxed($this->ps, $text, $left, $height - $style['font'], $right - $left, $style['font'], $style['align'], '');
 }
コード例 #2
0
ファイル: ps.php プロジェクト: abbeet/server39
 function begin_example_box($p, $llx, $lly, $title, $font)
 {
     ps_save($p);
     ps_translate($p, $llx, $lly);
     ps_setcolor($p, "fill", "gray", 0.5, 0.0, 0.0, 0.0);
     ps_rect($p, 0, EXAMPLE_BOX_HEIGHT - EXAMPLE_BOX_TITLE_HEIGHT, EXAMPLE_BOX_WIDTH, EXAMPLE_BOX_TITLE_HEIGHT);
     ps_fill($p);
     ps_setcolor($p, "stroke", "gray", 1.0, 0.0, 0.0, 0.0);
     ps_setfont($p, $font, 12.0);
     ps_show_xy($p, $title, 10, EXAMPLE_BOX_HEIGHT - EXAMPLE_BOX_TITLE_HEIGHT + 5);
     ps_setlinewidth($p, 1.0);
     ps_setcolor($p, "stroke", "gray", 0.0, 0.0, 0.0, 0.0);
     ps_rect($p, 0, 0, EXAMPLE_BOX_WIDTH, EXAMPLE_BOX_HEIGHT);
     ps_stroke($p);
     ps_moveto($p, 0, EXAMPLE_BOX_HEIGHT - EXAMPLE_BOX_TITLE_HEIGHT);
     ps_lineto($p, EXAMPLE_BOX_WIDTH, EXAMPLE_BOX_HEIGHT - EXAMPLE_BOX_TITLE_HEIGHT);
     ps_stroke($p);
 }
コード例 #3
0
ファイル: PS.php プロジェクト: ronaldoof/geocloud2
 /**
  * Set the PostScript fill style
  *
  * @param mixed $fillStyle The fillstyle to return, false if the one
  *   explicitly set
  * @return bool True if set (so that a line should be drawn)
  * @access private
  */
 function _setFillStyle($fillStyle = false)
 {
     if ($fillStyle === false) {
         $fillStyle = $this->_fillStyle;
     }
     if ($fillStyle == 'transparent' || $fillStyle === false) {
         return false;
     }
     $color = $this->_color($fillStyle);
     ps_setcolor($this->_ps, 'fill', 'rgb', $color[0], $color[1], $color[2], 0);
     return true;
 }
コード例 #4
0
ファイル: overprint.php プロジェクト: promoso/HVAC
<?php

define("LEFT_BORDER", 50);
function footer($ps, $text)
{
    $psfont = ps_findfont($ps, "Helvetica", "", 0);
    ps_setfont($ps, $psfont, 8.0);
    $buffer = "This file has been created with pslib " . ps_get_parameter($ps, "dottedversion", 0.0);
    ps_show_xy($ps, $buffer, LEFT_BORDER, 25);
}
$ps = ps_new();
if (!ps_open_file($ps, "overprint.ps")) {
    print "Cannot open PostScript file\n";
    exit;
}
ps_set_info($ps, "Creator", "draw.php");
ps_set_info($ps, "Author", "Uwe Steinmann");
ps_set_info($ps, "Title", "Overprint");
ps_begin_page($ps, 596, 842);
footer($ps, "");
ps_setcolor($ps, "fill", "cmyk", 1.0, 0.0, 0.0, 0.0);
ps_rect($ps, 100, 100, 200, 200);
ps_fill($ps);
ps_setoverprintmode($ps, 1);
ps_rect($ps, 120, 120, 100, 100);
ps_fill($ps);
ps_end_page($ps);
ps_close($ps);
ps_delete($ps);
コード例 #5
0
ファイル: text.php プロジェクト: promoso/HVAC
ps_show_xy($ps, "Text with some ligatures ffi fi fl ff", 100, 550);
ps_set_parameter($ps, "ligatures", "false");
ps_show_xy($ps, "Text without ligatures ffi fi fl ff", 100, 520);
ps_set_parameter($ps, "ligatures", "true");
ps_set_value($ps, "charspacing", 2.0);
ps_show_xy($ps, "Text with char spacing set to 2.0", 100, 490);
ps_set_value($ps, "charspacing", 0.0);
ps_show_xy($ps, "Text with char spacing set to 0.0", 100, 460);
ps_set_value($ps, "charspacing", -2.0);
ps_show_xy($ps, "Text with char spacing set to -2.0", 100, 430);
ps_set_value($ps, "charspacing", 0.0);
ps_show_xy($ps, "Some text which will be continued ...", 100, 400);
ps_continue_text($ps, "... in the next line ...");
ps_set_value($ps, "leading", 30);
ps_continue_text($ps, "... and another one with leading set to 30.");
ps_setcolor($ps, "both", "rgb", 1.0, 0.0, 0.0, 0.0);
ps_show_xy($ps, "Text can be written in color.", 100, 340);
ps_end_page($ps);
ps_begin_page($ps, 596, 842);
ps_setfont($ps, $font, 14.0);
ps_set_value($ps, "leading", 16);
ps_show_boxed($ps, "Text can be put into a box. It will automatically line wrapped. The text can left or right justified or centered. The given coordinates specify the lower left corner.", 100, 550, 100, 200, "left");
ps_show_boxed($ps, "Text can be put into a box. It will automatically line wrapped. The text can left or right justified or centered. The given coordinates specify the lower left corner.", 235, 550, 100, 200, "center");
ps_show_boxed($ps, "Text can be put into a box. It will automatically line wrapped. The text can left or right justified or centered. The given coordinates specify the lower left corner.", 370, 550, 100, 200, "right");
ps_set_value($ps, "leading", 30);
$text = "The line spacing (leading) can be set as on page 1. If the text does not fit into the box, it will be cut off. The string length of the remaining text is returned. This makes it quite easy to continue the remaining text in a second, third, fourth etc. box.";
$len = ps_show_boxed($ps, $text, 100, 320, 100, 200, "justify");
$len = ps_show_boxed($ps, substr($text, strlen($text) - $len), 235, 320, 100, 200, "justify");
$len = ps_show_boxed($ps, substr($text, strlen($text) - $len), 370, 320, 100, 200, "justify");
ps_set_value($ps, "leading", 20);
ps_set_parameter($ps, "hyphenation", "true");