$data = "ÿÿÿ"; /* ->image_raw_embed() it not intended to be the end-all * user interface, but this is how you use it to embed * something manually: * The first parameter is the image data itself * The second is the colorspace. * The third is the number of bits per pixel * The fourth is the height of the image * The fifth is the width of the image * The sixth parameter is the encoding, which has possibilities * such as /DCTEncode (the .jpeg compression method) If left * off, no encoding is used. * This method returns an ID code for the embedded image, * which is used to place the image */ $image = $pdf->image_raw_embed($data, "/DeviceRGB", 8, 1, 3); /* This example shows how to use the ->jfif_embed() * funtion, which can be used to embed JFIF images * (commonly know as JPEGs) * ->jfif_embed() needs only the data itself, as it * is capable of extracting other required data (such * as height and width) from the data. * This example is commented out because we don't ship * an example JPEG image with the library. Just change * $fn to the [path]filename of a jpeg image and use * the method to embed it, you can then use * ->image_place() to place it on a page. * Obviously, you can get the JFIF(JPEG) data from anywhere, * such as a database query, or an HTTP POST operation. * The library doesn't care, just as long as it's valid * JFIF formatted data.
// Fixed paragraph string $pdf->template->paragraph($t1, 0, 340, 70, 400, 'This is text that will wrap so it fits the space'); // Variable paragraph $pdf->template->pfield($t1, 0, 410, 70, 470, 'para'); /* To demonstrate the graphic capabilities of templates * we're going to do some interesting stuff ... * First we'll make three images, each 1 pixel square * of a solid color (1 red, 1 blue, 1 green) and embed * them in the pdf file * If you're wondering, this is a silly way to do this. * It would be easier and smarter to use filled rectangles, * but this is not intended as a "best practice" example, * but only to illustrate capibilities. */ $d = "ÿ"; $im[0] = $pdf->image_raw_embed($d, '/DeviceRGB', 8, 1, 1); $d = "ÿ"; $im[1] = $pdf->image_raw_embed($d, '/DeviceRGB', 8, 1, 1); $d = "ÿ"; $im[2] = $pdf->image_raw_embed($d, '/DeviceRGB', 8, 1, 1); // Now we'll attach a red rectangle to the template $pdf->template->image($t1, 280, 5, 20, 20, $im[0]); /* Now we'll place an "image field" (i.e. a "variable" image) * next to the previous image. When the band is placed, an * image will be dynamically selected to insert into the * space we create here */ $pdf->template->ifield($t1, 310, 5, 20, 20, 'image'); /* Now got through a loop and manually place 7 of these * templates on this page */