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

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,

I'm trying to use PDF API2 to output in landscape and to rotate the text and image accordingly. I have somehow gotten the text to rotate 90% but I can't do the same for the image (it doesn't show on the page). Here's my code:
my $pdf=PDF::API2->new; my $font = $pdf->corefont('Helvetica'); my $page = $pdf->page(); $page->mediabox('A4'); $page->rotate(90); # to landscape my $content = $page->text(); $content->font($font,12); $content->transform( -rotate => 90, -translate => [100,500], ); $content->text("This text should appear on the left half of the A4 + Landscape page"); my $photo = $page->gfx; my $photo_file = $pdf->image_jpeg("image.jpg"); $photo->save; # does not rotate correctly because I don't quite understand the t +ranslate part $photo->transform( -rotate => 90, -translate => [my $_x = 0, my $_y = 0], ); $photo->image($photo_file, 50, 360, 200, 200); $photo->restore; $pdf->saveas("test.pdf"); $pdf->end;

I would like to print the rotated text and image on the left half of the landscape page and then to repeat the same text and image on the right half of the landscape page.

Could anyone help shed some light?