|Perl: the Markov chain saw|
Re: PDF API2 - landscape and rotating text and imageby kcott (Bishop)
|on Jul 24, 2020 at 22:16 UTC||Need Help??|
"# does not rotate correctly because I don't quite understand the translate part"
When you rotate the page ($page->rotate(90)) to change from portrait to landscape, the X-Y axes change from horizontal-vertical to vertical-horizontal. The -translate values reference the axes; you need to adjust them for the page rotation change. I suspect this is maybe causing you problems understanding what's going on here: it's neither immediately obvious nor intuitive, so your confusion is unsurprising. I suggest you spend some time playing around with the values to get a feel for this.
The following code generates a landscape-oriented page which roughly looks like this:
+-------------------------+ | Left text Right text | | | | +------+ +------+ | | | ^^ | | ^^ | | | | || | | || | | | | img1 | | img2 | | | +------+ +------+ | +-------------------------+
I used different text and images purely for testing purposes; obviously, you can use the same text and images on both sides. The images were 64x64 pixel PNGs which had a clear UP direction (to check the rotation).
You'll no doubt need to change certain values to suit your layout requirements; however, I hope this gives you a solid starting point.