Adding images to the page
Adding images to your PDF document starts by loading your image file, which must be in TIFF, PNG, or JPEG format, passing its full path to the Zend_Pdf_Image::image-WithPath() method, then adding it to the page like so:
$image = Zend_Pdf_Image::imageWithPath($file);
The x and y values here are the same as you'd use for drawing a rectangle. Your image will be stretched to fit the specified size if it isn't the same as, or proportional to, the original image size.
If you need to load alternative image formats, or you want better image resizing, you might consider using the GD library to save a modified version of the image file to be loaded into your PDF.
In cases where we want to show only a part of an image or object in our document, we can use clipping masks.
Post a comment