11.4.5 PDF special effects: pdf_rotate() and pdf_skew()This is NOT the latest copy of this book; click here for the latest version.
bool pdf_rotate ( resource pdfdoc, float degrees)
bool pdf_skew ( resource pdfdoc, float alpha, float beta)
We can further manipulate images through the use of pdf_rotate() and pdf_skew() - two functions you should be able to guess quite easily.
As per usual, both pdf_rotate() and pdf_skew() take a PDF document reference as their first parameter. pdf_rotate() then takes one extra parameter - how much to rotate the co-ordinate system by, in degrees - whereas pdf_skew takes two extra parameters - how much to skew the co-ordinate system by in the X direction and how much in the Y direction.
Try adding these two lines just after the call to pdf_begin_page() inside the loop:
pdf_skew($pdf, 10, 10); pdf_rotate($pdf, 5);
Re-save the file and generate the PDF file again. You may need to comment one of the lines out at a time to clearly see what effect each call has on your document, however you should also notice that these two functions allow you to rotate and skew your text as well as your pictures.
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|