Im trying to produce a PDF document using the PHP FPDF library,
Im trying to draw a line horizontal over the page which is indented the same amount both on the left and right sides.
Im having real difficulty trying to accomplish this.
My code is as follows, any help would be greatly appreciated.
$pdf = new FPDF( 'P', 'mm', 'A4' );
$pdf->AddPage();
$pdf->SetDisplayMode(real,'default');
$pdf->SetFillColor(0,0,0);
$pdf->SetFont('Arial','B',16);
$pdf->Image('logo.jpg',20,10,50,33.3);
$pdf->SetDrawColor(188,188,188);
$pdf->Line(20,45,150,45);
Given a portrait, A4 page is 210mm wide, a simple bit of maths should help you resolve this:
$pdf->Line(20, 45, 210-20, 45); // 20mm from each edge
$pdf->Line(50, 45, 210-50, 45); // 50mm from each edge
This is given that your declaration is as you stated in your original question:
$pdf = new FPDF( 'P', 'mm', 'A4' ); // A4, portrait, measurements in mm.