smith.james0 Posted April 7, 2006 Share Posted April 7, 2006 It the moment I use this code to to write the week number on top of a pdf template.[code]require('../pdf/fpdi.php');$week = $_POST[week];$pdf= new fpdi();$pagecount = $pdf->setSourceFile("weelkytargets.pdf");$tplidx = $pdf->ImportPage(1);$pdf->addPage();$pdf->useTemplate($tplidx,10,10); $pdf->SetFont('Arial','',18); $pdf->SetTextColor(0); $pdf->SetXY(142,33); $pdf->write(10,"$week"); $pdf->Output("newpdf.pdf","I");$pdf->closeParsers();[/code]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.[code]require('../pdf/rotation.php');class PDF extends PDF_Rotate{function RotatedText($x,$y,$txt,$angle){ //Text rotated around its origin $this->Rotate($angle,$x,$y); $this->Text($x,$y,$txt); $this->Rotate(0);}function RotatedImage($file,$x,$y,$w,$h,$angle){ //Image rotated around its upper-left corner $this->Rotate($angle,$x,$y); $this->Image($file,$x,$y,$w,$h); $this->Rotate(0);}}$pdf=new PDF();$pdf->AddPage();$pdf->SetFont('Arial','',20);$pdf->RotatedText(100,60,'Hello!',45);$pdf->Output();[/code]This works great but i carn't get it to work with the template, can anyone help?Thanks James Quote Link to comment Share on other sites More sharing options...
smith.james0 Posted April 8, 2006 Author Share Posted April 8, 2006 Anyone? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.