略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ps_set_text_pos

2024-12-21

ps_set_text_pos

(PECL ps >= 1.1.0)

ps_set_text_posSets position for text output

说明

ps_set_text_pos(resource $psdoc, float $x, float $y): bool

Set the position for the next text output. You may alternatively set the x and y value separately by calling ps_set_value() and choosing textx respectively texty as the value name.

If you want to output text at a certain position it is more convenient to use ps_show_xy() instead of setting the text position and calling ps_show().

参数

psdoc

Resource identifier of the postscript file as returned by ps_new().

x

x-coordinate of the new text position.

y

y-coordinate of the new text position.

返回值

成功时返回 true, 或者在失败时返回 false

范例

示例 #1 Placing text at a given position

<?php
$ps 
ps_new();
if (!
ps_open_file($ps"text.ps")) {
  print 
"Cannot open PostScript file\n";
  exit;
}

ps_set_info($ps"Creator""rectangle.php");
ps_set_info($ps"Author""Uwe Steinmann");
ps_set_info($ps"Title""Text placement example");

ps_begin_page($ps596842);
$psfont ps_findfont($ps"Helvetica"""0);
ps_setfont($ps$psfont8.0);
ps_show_xy($ps"Some text at (100, 100)"100100);

ps_set_value($ps"textx"100);
ps_set_value($ps"texty"120);
ps_show($ps"Some text at (100, 120)");
ps_end_page($ps);

ps_delete($ps);
?>

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/function.ps-set-text-pos.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3