2012-03-11 3 views
0

이 내 코드는 PDF를 생성FPDF 밤은 추가 새 페이지

"$arrIds = array('10'); ". 

배열 예를 들어, 1 개 값이 그 때 PDF를 생성하기 위해 노력하고있는 내 코드의 조각,하지만 더있을 때 배열의 값을 다음 페이지를 볼 수 없습니다.

public function generate_pt10($pt10values) 
{ 
    $tax_amount = round(@$pt10values[0]['tax_amount']); 

    $self_rented = @$pt10values[0]['self_rent']; 
    switch ($self_rented) 
    { 
     case '1': 
      $self_rented = 'Self'; 
      break; 
     case '2': 
      $self_rented = 'Rented'; 
      break; 
     case '3': 
      $self_rented = '1)Self 2)Rented'; 
      break; 
    } 

    $location = @$pt10values[0]['location']; 
    switch ($location) 
    { 
     case '1': 
      $location = 'Main Road'; 
      break; 
     case '2': 
      $location = 'Off Road'; 
      break; 
    } 


    $baseXcoordinate = 5; 

    $this->_FpdfGenerator->AddPage(); 
    $this->_FpdfGenerator->AliasNbPages(); 
    $this->_FpdfGenerator->SetXY($baseXcoordinate, 10); 
    $this->_FpdfGenerator->SetFont('Arial', 'B', 5); 
    $this->_FpdfGenerator->MultiCell(13, 7, 'Rating Area', 1); 
    $this->_FpdfGenerator->SetXY(18, 10); 
    $this->_FpdfGenerator->SetFont('Arial', 'B', 6); 
    $this->_FpdfGenerator->MultiCell(15, 7, 'Zone', 1); 
    $this->_FpdfGenerator->SetXY(33, 10); 
    $this->_FpdfGenerator->SetFont('Arial', 'B', 5); 
    $this->_FpdfGenerator->MultiCell(25, 7, 'Area', 1); 
    $this->_FpdfGenerator->SetXY($baseXcoordinate, 24); 
    $this->_FpdfGenerator->SetFont('Arial', 'B', 7); 
    $this->_FpdfGenerator->MultiCell(28, 9, 'Property No', 1); 
    $this->_FpdfGenerator->SetXY($baseXcoordinate, 33); 
    $this->_FpdfGenerator->SetFont('Arial', 'B', 7); 
    $this->_FpdfGenerator->MultiCell(28, 9, 'Pin', 1); 
    $this->_FpdfGenerator->SetXY(58, 10); 
    $this->_FpdfGenerator->SetFont('Arial', 'B', 6); 
    $this->_FpdfGenerator->MultiCell(20, 7, 'Issue Date', 1); 
    $this->_FpdfGenerator->SetXY(78, 10); 
    $this->_FpdfGenerator->SetFont('Arial', 'B', 6); 
    $this->_FpdfGenerator->MultiCell(25, 7, 'Due Date For Payment', 1); 
    $this->_FpdfGenerator->SetXY(89.5, 10); 
    $this->_FpdfGenerator->ln(); 
    $this->_FpdfGenerator->Output(); 
    } 

function action_pdf_reportPt10() 
{ 
    $arrIds = array('10', '5', '12', '31'); 
    foreach ($arrIds as $id) 
    { 
     $this->_Pt10_Calculations->setPropertyId($id); 
     $this->_FpdfGenerator = new Fpdf('L'); 
     $pt10values = $this->_Pt10_Calculations->fetch_record_by_property_id(); 


     $this->generate_pt10($pt10values); 

    } 

    $this->load->view('admin/property/report_pt10', $this->view_data); 
} 

그리고

난 내가 뭔가 잘 작동 배열의 단일 값 사촌을 잃었 무엇인지 잘 모릅니다. 그러나 배열에 더 많은 값이 있으면 페이지를 추가하지 않습니다.

답변

1

$this->_FpdfGenerator->Output();here이 문서 인 문서를 종료, 그래서 일부 데이터가

+0

흠 확인 나 해보자 추가 할 수있는 경우 당신은 전화 should'n. –

+0

function action_pdf_reportPt10() { $ arrIds = array ('10 ','5 ','12 ', 31'); foreach ($ arrIds as $ id) { $ this -> _ Pt10_Calculations-> setPropertyId ($ id); $ this -> _ FpdfGenerator = new Fpdf ('L'); $ pt10values ​​= $ this -> _ Pt10_Calculations-> fetch_record_by_property_id(); $ this-> generate_pt10 ($ pt10values); } $ this -> _ FpdfGenerator-> Output(); $ this-> load-> view ('admin/property/report_pt10', $ this-> view_data); } –

+0

나는 루프가 작동하지 않는 그것을 꺼냈다. –