I know that PDF::API2 has the "rotate" and "translate", but am I right in thinking this applies to the whole page content?
What I am TRYING to do is arrange 16x A4 prints into an A0 PDF. I THOUGHT I could load an image, rotate it, and move it to X/Y co-ordinates, using a loop to move across and up. The images are created at 300DPI, so the inches dimensions when divided by 72 come out at around 595 x 842 (portrait mode when rotated)
I also thought that the bottom left corner once rotated would be 595 to the right of the true PDF 0,0 co-ordintates of bottom left of PDF.
Alas, at present, it appears to be adding a photo, rotating page, adding another, rotating page and so on. So its not moving up the page as expected either.
Have I got to rotate my original images, and then just use co-ordinates to place? Or is there a potential workaround?
my $dir='../../wordboards/standard'; opendir my $dh, $dir or die "Could not open '$dir' for reading '$!'\n" +; my @pics = readdir $dh; closedir $dh; shift @pics; shift @pics; my $pdf = PDF::API2->new(); # Set the page size my $page = $pdf->page(); $page->mediabox('A0'); #Each A4 is 841 x 595 my $content = $page->gfx; for (my $row=0; $row<4; $row++){ for (my $col=0; $col<4; $col++){ my $count=($row*4)+$col; my $photoFile = $pdf->image_jpeg($dir."/".$pics[$count]); $content->image($photoFile, 0, 0); $content->transform( -translate => [my $_x = 595+($row*595), my $_y = ($col*8 +42)], # Top left is 0,0 when rotated (ie bottom left is 842 points + to right) -rotate => 90, ); } }
Since an image is usually placed bottom left to top left, once rotated 90 degrees, my theory is that it would be printed in columns of data running right to left, hence moving start co-ordinates to the right
In reply to Making a 4 x 4 of rotated images (PDF::API2) by cristofayre
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |