Name

image_place -- paint an image to a page

Synopsis

int image_place ( int imageid, float bottom, float left, int parent[, array parameters] )

Description

This function paints an image to a page. The image must have been embedded in the PDF file with jfif_embed(), png_embed(), or image_raw_embed().

imageid is the library ID returned by the embedding method. bottom and left specify the location of the image on the page. parent defines the library ID of a page to place the image. Important elements of the parameters array are the scale factor and the rotation, which determine the manner of placment. X and Y scale factors can be specified seperately by making the scale element of the parameters array an array in itself containing 'x' and 'y' elements.

Examples

Assuming that image.jpg is a valid JFIF file, the following code will extract the file data, embed it into the PDF file, and paint it to a page.

$page = $pdf->new_page("letter");
$fh = fopen("image.jpg", "r");
$filedata = fread($fh, filesize("image.jpg"));
fclose($fh);
$image = $pdf->jfif_embed($filedata);
$placement = $pdf->image_place($image, 10, 10, $page);

See Also

History

Bugs

Most errors reported with the image system are usually not the fault of phppdflib. Please be sure that you have the latest version of the PDF viewer program you are using, as well as an image that is valid to begin with.