http://www.perlmonks.org?node_id=695025


in reply to PDF::API2 question in images

The image L.png is missing because you don't start a new page before adding the jpeg, so the jpeg ends up covering the png.

You can control the image size e.g. by using an art box. The positioning can be taken care of using the image method (taking as parameters the image, the left x coordinate, the lower y coordinate and a scaling factor). To get the desired result in your program, please check replacing the lines starting with "foreach my $img (@imgs) {..." by the following code, using example coordinates $min_x, $min_y for better illustration:

my $min_x = 150; my $min_y = 100; foreach my $img (@imgs) { $page=$pdf->page; $page->artbox(0, 0, $img->width,$img->height); $gfx=$page->gfx; $gfx->image($img, $min_x, $min_x, 1); } $page=$pdf->page; $page->artbox($jpeg->width,$jpeg->height); $gfx=$page->gfx; $gfx->image($jpeg, $min_x, $min_y, 1); $pdf->save; $pdf->end();
I feel the module's documentation on CPAN is quite good, besides there are wrapper modules if you want a simpler interface (e.g. PDF::API2::Simple). Also, PDF is a well documented standard, so you can use its documentation, and since PDF::API2 does not rename entities, you should be able to look up things in case the module's documentation is not sufficient.