Harikris
Harikris

Reputation: 310

PHP to fpdf orientation issue

I am trying to set the fpdf orientation to Landscape mode.

function PDF($orientation='L',$unit='pt',$format='A4') 
{
    //Call parent constructor
    $this->FPDF($orientation,$unit,$format);
    //Initialization
    $this->B=0;
    $this->I=0;
    $this->U=0;
    $this->HREF='';
}

$pdf=new FPDF();
$pdf->SetTitle('HariKrishnan'); //change the title of the pdf here
$pdf->AddPage();
//Fields Name position
$Y_Fields_Name_position = 35;
//Table position, under Fields Name
$Y_Table_Position = 42;
  //To make the contents bold, use B , '' means regular font here
$ypos=0;

//Image(string file [, float x [, float y [, float w [, float h [, string type [, mixed link]]]]]])
$pdf->Image('images/logo.jpg',10,10,'42','15','JPEG','');
$pdf->Image('images/iia.jpg',10,40,'240','90','JPEG','');  

But the pdf is not showing in landscape mode, showing only portrait mode.

How can i make it Landscape.

Please help.

Upvotes: 0

Views: 1352

Answers (1)

jogesh_pi
jogesh_pi

Reputation: 9782

This may work for you.

class PDF extends FPDF {

    function __construct($orientation='L',$unit='pt',$format='A4') {
         parent::_construct();
    }
}

and use like this:

$pdf = new PDF();
$pdf->SetTitle('HariKrishnan'); //change the title of the pdf here
$pdf->AddPage();

---- 
// Rest Codes

Upvotes: 1

Related Questions