コード例 #1
0
ファイル: overprint.php プロジェクト: promoso/HVAC
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);
}
コード例 #2
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'], '');
 }
コード例 #3
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);
 }
コード例 #4
0
ファイル: fontcreate.php プロジェクト: promoso/HVAC
ps_circle($psdoc, 450, 250, 80);
ps_fill($psdoc);
ps_circle($psdoc, 450, 450, 80);
ps_fill($psdoc);
ps_circle($psdoc, 450, 650, 80);
ps_fill($psdoc);
ps_circle($psdoc, 650, 250, 80);
ps_fill($psdoc);
ps_circle($psdoc, 650, 450, 80);
ps_fill($psdoc);
ps_circle($psdoc, 650, 650, 80);
ps_fill($psdoc);
ps_end_glyph($psdoc);
ps_add_kerning($psdoc, "one", "two", 100);
ps_add_ligature($psdoc, "one", "two", "nine");
ps_add_ligature($psdoc, "nine", "three", "zero");
ps_end_font($psdoc);
ps_begin_page($psdoc, 596, 842);
ps_setfont($psdoc, $myfont, 80.0);
ps_show_xy($psdoc, "123456", 80, 700);
ps_setfont($psdoc, $myfont, 60.0);
ps_show_xy($psdoc, "12345678", 80, 600);
ps_setfont($psdoc, $myfont, 40.0);
ps_show_xy($psdoc, "1234567890", 80, 500);
ps_setfont($psdoc, $myfont, 20.0);
ps_show_xy($psdoc, "1234567890", 80, 400);
ps_setfont($psdoc, $myfont, 10.0);
ps_show_xy($psdoc, "1234567890", 80, 300);
ps_end_page($psdoc);
ps_close($psdoc);
ps_delete($psdoc);
コード例 #5
0
ファイル: fontsample.php プロジェクト: promoso/HVAC
            ps_stroke($ps);
        }
    }
    /* The name of the symbol */
    ps_setfont($ps, $psfont, 3);
    for ($j = 0; $j < 16; $j++) {
        for ($i = 0; $i < 16; $i++) {
            $text = ps_symbol_name($ps, $j * 16 + $i, $samplefont);
            ps_set_value($ps, "textx", $leftmargin + $i * $colwidth + 2);
            ps_set_value($ps, "texty", $bottommargin + (15 - $j) * $rowheight + 2);
            ps_show($ps, $text);
            $text = sprintf(" (%d)", $j * 16 + $i);
            ps_show($ps, $text);
        }
    }
    $text = "This fontsample matrix is created with the ps_symbol() function. It prints a glyph by its decimal value in the font encoding vector. pslib can use the TeXBase1 encoding (default) or the encoding shipped with the font itself, which is usually AdobeStandardEncoding. The above matrix uses the encoding of the font which is used when the parameter 'encoding' of ps_findfont() is set to 'builtin'. This usually results in a subset of all available glyphs of the font.\n\nQuite a lot of glyphs cannot be reached without the ps_symbol() function. The reason is simple: If text is output with ps_show(), then each character will be first mapped to a glyph by applying the ISO-8859-1 input encoding on it. Since ISO-8859-1 has less characters then a font usually provides glyphs, there will be some glyphs not reachable with regular text.";
    ps_setfont($ps, $psfont, 8);
    ps_set_value($ps, "leading", 12.0);
    ps_set_value($ps, "parindent", 12.0);
    ps_show_boxed($ps, $text, $leftmargin, $bottommargin - 250, $colwidth * 7.5, 230, "fulljustify", NULL);
    ps_setfont($ps, $samplefont, 8);
    ps_set_value($ps, "leading", 12.0);
    ps_set_value($ps, "parindent", 12.0);
    ps_show_boxed($ps, $text, $leftmargin + $colwidth * 8.5, $bottommargin - 250, $colwidth * 7.5, 230, "fulljustify", NULL);
    ps_end_page($ps);
}
ps_close($ps);
ps_delete($ps);
?>

コード例 #6
0
ファイル: PS.php プロジェクト: ronaldoof/geocloud2
 /**
  * Set the PostScript font
  *
  * @access private
  */
 function _setFont()
 {
     $this->_psFont = false;
     if (isset($this->_font['name'])) {
         ps_set_parameter($this->_ps, 'FontOutline', $this->_font['name'] . '=' . $this->_font['file']);
         $this->_psFont = ps_findfont($this->_ps, $this->_font['name'], $this->_font['encoding'], $this->_font['embed']);
         if ($this->_psFont) {
             ps_setfont($this->_ps, $this->_psFont, $this->_font['size']);
             $this->_setFillStyle($this->_font['color']);
         }
     } else {
         $this->_setFillStyle('black');
     }
 }
コード例 #7
0
ファイル: glyphlist.php プロジェクト: promoso/HVAC
            ps_setlinewidth($ps, 0.2);
            for ($j = 0; $j < 16; $j++) {
                for ($i = 0; $i < 16; $i++) {
                    if ($glc + ($j * 16 + $i) < $listlen) {
                        $textwidth = ps_glyph_width($ps, $glyphlist[$glc + ($j * 16 + $i)], 0, $fontsamplesize);
                        ps_set_value($ps, "textx", $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2);
                        ps_set_value($ps, "texty", $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
                        ps_glyph_show($ps, $glyphlist[$glc + ($j * 16 + $i)]);
                        ps_moveto($ps, $leftmargin + $i * $colwidth + $colwidth / 2 - $textwidth / 2, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
                        ps_lineto($ps, $leftmargin + $i * $colwidth + $colwidth / 2 + $textwidth / 2, $bottommargin + (15 - $j) * $rowheight + $rowheight / 2 + 3 - $fontsize / 2);
                        ps_stroke($ps);
                    }
                }
            }
            /* The name of the symbol */
            ps_setfont($ps, $psfont, 3);
            for ($j = 0; $j < 16; $j++) {
                for ($i = 0; $i < 16; $i++) {
                    if ($glc + ($j * 16 + $i) < $listlen) {
                        ps_set_value($ps, "textx", $leftmargin + $i * $colwidth + 2);
                        ps_set_value($ps, "texty", $bottommargin + (15 - $j) * $rowheight + 2);
                        ps_show($ps, $glyphlist[$glc + ($j * 16 + $i)]);
                    }
                }
            }
            ps_end_page($ps);
            $glc += 256;
        }
    }
}
ps_close($ps);
コード例 #8
0
ファイル: text.php プロジェクト: promoso/HVAC
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");
ps_set_parameter($ps, "hyphendict", "D:/xampp/htdocs/xampp/external/ps/hyph_en.dic");
ps_set_value($ps, "hyphenminchars", 2);
$text = "You wonder if hyphenation is supported? Yes, of course and it uses the hyphenation files from scribus. Scribus provides hyphenation dictionaries for 14 languages. Another nice feature is Protution. This means that certain characters reach over the left or right margin. This is very useful for hyphens or punctuation to make straight looking margins like the one in the first column (it is very exaggerated).";
ps_set_parameter($ps, "RightMarginKerning", "hyphen=1000");
コード例 #9
0
ファイル: hyperlinks.php プロジェクト: promoso/HVAC
$ps = ps_new();
if (!ps_open_file($ps, "hyperlinks.ps")) {
    print "Cannot open PostScript file\n";
    exit;
}
ps_set_parameter($ps, "warning", "true");
ps_set_info($ps, "Creator", "hyperlinks.php");
ps_set_info($ps, "Author", "Uwe Steinmann");
ps_set_info($ps, "Title", "Creating Hyperlinks with pdfmarks");
$fontsize = 20.0;
ps_begin_page($ps, 596, 842);
$b1 = ps_add_bookmark($ps, "Content", 0, 0);
ps_add_bookmark($ps, "First Page", $b1, 0);
$psfont = ps_findfont($ps, "Helvetica", "", 0);
ps_setfont($ps, $psfont, $fontsize);
ps_set_value($ps, "leading", 14.0);
ps_show_xy($ps, "This is a web link", 100, 100);
$len = ps_stringwidth($ps, "This is a web link", $psfont, $fontsize);
ps_add_weblink($ps, 100, 100, 100 + $len, 130, "http://www.mmk-hagen.de");
ps_show_xy($ps, "This is a pdf link to an external document", 100, 150);
$len = ps_stringwidth($ps, "This is a pdf link to an external document", $psfont, $fontsize);
ps_add_pdflink($ps, 100, 150, 100 + $len, 180, "test.pdf", 1, "fitpage");
ps_show_xy($ps, "This is a launch link", 100, 200);
$len = ps_stringwidth($ps, "This is a launch link", $psfont, $fontsize);
ps_add_launchlink($ps, 100, 200, 100 + $len, 230, "/usr/bin/gedit");
ps_show_xy($ps, "This is a pdf link within the document", 100, 250);
$len = ps_stringwidth($ps, "This is a pdf link within the document", $psfont, $fontsize);
ps_add_locallink($ps, 100, 250, 100 + $len, 280, 2, "fitpage");
ps_end_page($ps);
ps_begin_page($ps, 300, 300);