Re: note 15984 added to function.pdf-get-value
| From: | Zak Greant | Date: | Thu, 11 Oct 2001 07:41:40 +0000 |
| Subject: | Re: note 15984 added to function.pdf-get-value | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-18818@lists.php.net to get a copy of this message | ||
On October 11, 2001 01:18 am, spectral*SPAM-FREE*@faqhackers.nl wrote:
> Some _MORE_ documentation about this function would be VERY
> appriciated. Almost every other function in the pdflib is depreciated
> and points to this one. Anyone has a list with parameters this
> function accepts?
Here are some docs from the PHP Functions Essential Reference
(http://php-er.com) until the doc team gets a chance to update the
manual. I would have just sent you to the site, but I have not yet
gotten the html version of the book online yet. :o)
double pdf_get_value (
resource pdf,
string key,
[double modifier]
);
Returns the setting of value for key
Gets the current setting of a value in the PDF document. This could be
a default value or a value set using pdf_set_value(). Only a subset of
the values able to be set with pdf_set_value() can be retrieved using
this function. These are:
- leading
- textrise
- horizscaling
- textrendering
- charspacing
- wordspacing
New values that can be accessed are:
font
Identifier of the current font set with pdf_setfont()
fontsize
Current size of the font set with pdf_setfont().
capheight
Height of a capital letter of the loaded font
ascender
Height of a letter of the loaded front from the baseline to the top of
the letter
descender
Height of the descending portion of a font from the baseline to the
bottom of a font. For example, the distance from the baseline to the
bottom of the letter 'p'
textx
X coordinates of the current text position
texty
Y coordinates of the current text position
currentx
X coordinates of the current point
currenty
Y coordinates of the current point
imagewidth
Width in pixels of the currently loaded image
imageheight
Height in pixels of the currently loaded image
resx
Horizontal resolution of the currently loaded image
resy
Vertical resolution of the currently loaded image
Since version 4.0.1
Example 1.37. Show image information
<?php
//create new document
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_begin_page($pdf, 500, 700);
// get image width and height
$im = pdf_open_image_file($pdf, "png", "logo.png");
$imgx = pdf_get_value($pdf, "imagewidth", $im);
$imgy = pdf_get_value($pdf, "imageheight", $im);
pdf_close_image($pdf, $im);
// display image information
$font = pdf_findfont($pdf, "Courier", "host", 0);
pdf_setfont($pdf, $font, 10);
pdf_show_xy($pdf, "Image width: $imgx", 20, 650);
pdf_show_xy($pdf, "Image height: $imgy", 20, 640);
pdf_end_page($pdf);
pdf_close($pdf);
// output document
$data = pdf_get_buffer($pdf);
header("Content-type: application/pdf");
header("Content-disposition: inline; filename=test.pdf");
header("Content-length: " . strlen($data));
echo $data;
?>
--
Zak Greant
PHP Quality Assurance Team
http://qa.php.net/
"We must be the change we wish to see." - M. K. Ghandi