PAGE: while ($cnt < @$snippets ) { my $p2 = $pdf->importpage($vorlage, 2); my $gfx = $p2->gfx; $pcnt = 0; for my $row ( 0..$max_rows2 - 1 ) { for my $col ( 0..$max_cols - 1 ) { next PAGE if $cnt >= @$snippets || $pcnt > $max_cols * $max_rows2; last PAGE unless $snippets->[$cnt]; my $spdf = PDF::API2->open( $snippets->[$cnt]); my $xo = $pdf->importPageIntoForm($spdf,1); $spdf->end; $gfx->formimage($xo, $x0+ $col*$dw, $y2-$row*$dh, 1); $cnt++; $pcnt++; } } $pdf->finishobjects($p2, $gfx); }