Jump to content


This topic is now archived and is closed to further replies.


Rotating text in pdf using php

Recommended Posts

It the moment I use this code to to write the week number on top of a pdf template.


$week = $_POST[week];

$pdf= new fpdi();

$pagecount = $pdf->setSourceFile("weelkytargets.pdf");
$tplidx = $pdf->ImportPage(1);




This works ok when the document is portrate. I now have a document which is landscape, when using the code above it cuts of half of the page. So i need to either make the pdf i generate on the fly landscape or rotate the template and rotate the week number. I have tried to find how you make a landscape pdf but i haven't found anything. So i have tried rotating the text using this code.

class PDF extends PDF_Rotate
function RotatedText($x,$y,$txt,$angle)
    //Text rotated around its origin

function RotatedImage($file,$x,$y,$w,$h,$angle)
    //Image rotated around its upper-left corner

$pdf=new PDF();
This works great but i carn't get it to work with the template, can anyone help?

Thanks James

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.