(PECL ps >= 1.1.0)
ps_set_text_pos — 設定文字輸出的位置
設定下一次文字輸出的位置。您也可以分別呼叫 ps_set_value() 並選擇 textx
或 texty
作為值名稱,來單獨設定 x 和 y 值。
如果您想要在特定位置輸出文字,使用 ps_show_xy() 而不是設定文字位置並呼叫 ps_show() 會更方便。
範例 #1 在給定位置放置文字
<?php
$ps = ps_new();
if (!ps_open_file($ps, "text.ps")) {
print "無法開啟 PostScript 檔案\n";
exit;
}
ps_set_info($ps, "Creator", "rectangle.php");
ps_set_info($ps, "Author", "Uwe Steinmann");
ps_set_info($ps, "Title", "文字放置範例");
ps_begin_page($ps, 596, 842);
$psfont = ps_findfont($ps, "Helvetica", "", 0);
ps_setfont($ps, $psfont, 8.0);
ps_show_xy($ps, "在 (100, 100) 的一些文字", 100, 100);
ps_set_value($ps, "textx", 100);
ps_set_value($ps, "texty", 120);
ps_show($ps, "在 (100, 120) 的一些文字");
ps_end_page($ps);
ps_delete($ps);
?>