I am not sure if this would be of any help to you, but some time ago I wrote a module PDF::TableX which is built on top of PDF::API2 and simplifies generation of tabular pdfs. It can be relatively easy extended to work with images, see the code below:
#!/usr/bin/env perl -w # this extends the regular text cell with image capabilities package ImageContent; use Moose::Role; use PDF::API2; sub draw_content { my ($self, $x, $y, $gfx, $txt) = @_; $y -= ($self->padding->[0] + 200); $x += $self->padding->[3]; if ($y < $self->margin->[2]) { return (200, $self->height, 1); } else { my $image_object = $gfx->{' api'}->image_jpeg( $self->content +); $gfx->image($image_object, $x, $y, 200, 200); $self->height(200+$self->padding->[0]+$self->padding->[2]); return (200, $self->height, 0); } } sub _get_min_width { 200 + $_[0]->padding->[1] + $_[0]->padding->[3] } sub _get_reg_width { 200 + $_[0]->padding->[1] + $_[0]->padding->[3] } sub _get_height { 200 + $_[0]->padding->[0] + $_[0]->padding->[2] } # the actual script to build the page use Moose::Util qw( apply_all_roles does_role); use PDF::TableX; use PDF::API2; my $contents = [ ['http://something/something', 'img.jpg'], ['http://something/something', 'img1.jpg'], ['http://something/something', 'img2.jpg'], ['http://something/something', 'img3.jpg'], ]; my $table = PDF::TableX->new(2,4); my $pdf = PDF::API2->new(); $pdf->mediabox('a4'); my $page = $pdf->page; $table ->padding(0) ->border_width(0) ->text_align('center'); $table->[0]->border_width(0); foreach my $i (0..3) { foreach my $j (0..1) { if ($j == 1) { apply_all_roles( $table->[$i][$j], 'ImageConten +t'); } $table->[$i][$j]->content($contents->[$i][$j]); } } $table->draw($pdf, $page); $pdf->saveas('output.pdf');
or the documentation PDF::TableX

In reply to Re: Add images to PDF using pdf::ap12 by gpapkala
in thread Add images to PDF using pdf::ap12 by cristofayre

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.