Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

PDF_show_xy

(PHP 3 >= 3.0.6, PHP 4, PECL)

PDF_show_xy -- Output text at given position

Описание

bool PDF_show_xy ( resource p, string text, float x, float y )

Prints text in the current font. Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.



PDF_show> <PDF_show_boxed
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
PDF_show_xy
Christopher Jastram <cej at intech dot com>
11-Dec-2005 12:52
Here's a little function that creates a pdf_show_xy_right() function with exactly the same parameters as pdf_show_xy(), except that the third parameter now specifies the right-aligned edge position.

function pdf_show_xy_right(&$pdf, $text, $right, $bottom) {
    $fontname = pdf_get_parameter($pdf, "fontname", 0);
    $font = pdf_findfont($pdf, $fontname, "host", 0);
    $size = pdf_get_value($pdf, "fontsize", 0);
    $width = pdf_stringwidth($pdf, $text, $font, $size);
    pdf_show_xy($pdf, $text, $right-$width, $bottom);
}

Set your font name and size separately, just as you would with pdf_show_xy(), and then call this function like so:

pdf_show_xy_right($pdf, "Hello World", 50, 200);

The third parameter is the right edge, fourth parameter is the baseline.  You do NOT have to pass in the font and size!
sigve at NwOoSlPfArMaidah dot no
01-Oct-2004 07:21
Want to do right-to-left text with pdflib? Just pick the right margin, and send it as $x to this function.

<?php
function pdf_show_xy_backwards ($pdf, $text, $font, $size, $x, $y) {
   
$currx = $x;
    for (
$i = strlen($text); $i > 0; $i--) {
       
$char = substr((string)$text, $i-1, 1);
       
$width = pdf_stringwidth($pdf, (string)$char, $font, $size);
       
$currx = $currx - $width;
       
pdf_show_xy($pdf, (string)$char, $currx, $y);
    }
}
?>
DrPsycho at easynet dot be
06-Dec-2002 09:41
No, that's just because in PDF the origin is at the lower left corner
nid at home dot se
02-Oct-2002 02:26
When using PDFLib version 4.0.3 under PHP 4.2.1 on Windows the Y-position is reversed, which means, the Y is the number of pixels that should be visible BELOW the texts baseline.

PDF_show> <PDF_show_boxed
Last updated: Fri, 26 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571