note 61399 added to function.pdf-get-value
| From: | php-general at lists dot php dot net | Date: | Thu, 02 Feb 2006 15:29:58 +0000 |
| Subject: | note 61399 added to function.pdf-get-value | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102868@lists.php.net to get a copy of this message | ||
Note:
imagewidth and imageheigh do not return the actual width and height. Instead they are 2 times the
actual width and height. I don't understand why, but this seems to be the case with multi page
tiffs (and maybe other images). In order to insert a multi page tiff into a PDF without out of
control extra space do the following:
<?php
$pdf = pdf_new();
pdf_set_parameter($pdf, "licensefile", "/etc/pdflib/licensekeys.txt");
pdf_open_file($pdf, "/tmp/tifftest.pdf");
for ($i=1; $i<=4; $i++) {
$image = pdf_open_image_file($pdf, "tiff", "/tmp/test.tif", "page",
$i);
$w = pdf_get_value($pdf, "imagewidth", $image);
$h = pdf_get_value($pdf, "imageheight", $image);
// $w and $h are at this point 2*width and 2*height!!
// To place the image without having lots of extra space:
pdf_begin_page($pdf, $w/2, $h/2);
pdf_place_image($pdf, $image, 0, 0, 0.5);
pdf_close_image($pdf, $image);
pdf_end_page($pdf);
}
pdf_close($pdf);
?>
----
Server IP: 216.194.113.175
Probable Submitter: 206.158.184.143
----
Manual Page -- http://www.php.net/manual/en/function.pdf-get-value.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61399
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61399&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61399&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61399&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61399&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61399&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61399&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61399&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61399&report=yes
Search -- http://master.php.net/manage/user-notes.php