Thanks for the time in posting your code, but that's a little "heavy" for me. I ended up using a couple of for ->next loops
use PDF::API2; print "content-type: text/html\n\n"; use CGI::Carp qw( fatalsToBrowser ); $pdf = PDF::API2->new(-file => 'new.pdf'); # prepares filespace # 10 pages without above graphic = <3 seconds for ($doc=0; $doc<10; $doc++){ # Repeat for each new loop $page = $pdf->page(); # Adds new page to document. $page->mediabox('A4'); # Sets page size to A4 $font = $pdf->corefont('Verdana'); # Adds the Verdana font $text = $page->text(); # Adds some text to page $across=30; $up=48; $z=0; $qr=$pdf->image_png('test.png'); # Test pathname $arrow=$pdf->image_png('C:\...\arrows.png'); # Test pathname $gfx = $page->gfx; for ($x=0; $x<3; $x++){ # Across in 180dpi steps $new_across=$across+(180*$x); for ($y=0; $y<8; $y++){ # Up in 96dpi steps $new_up=$up+(96*$y); $text->font($font, 8); $text->translate($new_across, $new_up); $text->text('http://www.###/abcde/122345'); # Test URL $text->font($font, 9); $text->translate($new_across+11, $new_up+56); $text->text('Find Your'); $text->translate($new_across+16, $new_up+45); $text->text('Photos'); $text->font($font, 11); $text->translate($new_across+25, $new_up+34); $text->text('HERE'); $gfx->image($qr, ($new_across+90), ($new_up+10)); $gfx->image($arrow, ($new_across-4), ($new_up+12)); $z++; } } #$file=$pdf->image_png('C:\...label_layout.png'); # This is onl +y a test pathname #$gfx = $page->gfx; #$gfx->image($file, 0, 0); } # End of Page loop $pdf->save(); # Saves the file print "OK"; exit;
I will now add some code from GD library to create 24 QR code images, and then load them into page 1 by 1. Then discard them, and prepare the next batch for next page and so on.

In reply to Re^2: Add images to PDF using pdf::ap12 by cristofayre
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.