Как отобразить заголовок таблицы на каждой странице с помощью библиотеки FPDF?

просто нужна ваша помощь с моим кодом. Мой вопрос: как я могу получить заголовок таблицы с предыдущей страницы и получить доступ к ней на оставшихся страницах? Если у меня есть большие данные, я хочу указать также таблицу заголовков на каждой странице. Но я не знаю, как это сделать.

Вот функция, которая строит таблицу:

function BuildTable($header,$data) { //Colors, line width and bold font $this->SetFillColor(255,255,255); $this->SetTextColor(0); $this->SetDrawColor(0,0,0); $this->SetLineWidth(.3); $this->SetFont('Arial','',7); //Header // make an array for the column widths $this->SetFillColor(0,0,0); $this->SetTextColor(255); $this->SetDrawColor(0,0,0); $this->SetLineWidth(.3); $this->SetFont('','B'); $w = array(15,120,30,30); //CHANGE THIS // send the headers to the PDF document for($i = 0; $i < count($header); $i++) $this->Cell($w[$i],7,$header[$i],1,0,'C',1); $this->Ln(); //Color and font restoration $this->SetFillColor(255,255,230); $this->SetTextColor(0); $this->SetFont(''); $this->SetTextColor(0); $fill = false; // used to alternate row color backgrounds //HERE'S THE PART THAT LOOPS THE DATA foreach($data as $row){ $this->Cell($w[0],4,$row[0],'LR',0,'C',$fill); $this->SetFont(''); $this->Cell($w[1],4,$row[1],'LR',0,'L',$fill); $this->SetFont(''); $this->Cell($w[2],4,$row[2],'LR',0,'R',$fill); $this->SetFont(''); $this->Cell($w[3],4,$row[3],'LR',0,'R',$fill); $this->SetFont(''); $this->Ln(); $fill =! $fill; } $this->Cell(array_sum($w),0,'','T'); $this->Ln(50); $this->Ln(50); } 

Ниже приведен вызов класса PDF

 foreach($result->result_array() as $row){ $data[] = array($row['item_qty'], $row['itemname'], number_format($row['item_price'],2), number_format($row['total'],2), ); } $pdf = new PDF(); $pdf->AliasNbPages(); $header = array('QTY','ITEM / DESCRIPTION' , 'UNIT PRICE', 'TOTAL AMOUNT'); $pdf->SetFont('Arial','',8); $pdf->SetFillColor(255,0,0); $pdf->AddPage('l'); $pdf->Ln(); $pdf = new PDF(); 

Кстати, у меня есть функция верхнего и нижнего колонтитула. В первой строке мне нужно иметь 39 строк, исключая заголовок таблицы, а вторую строку, а остальные – 36 строк.

Как я могу это вычислить? Где мне нужно вычисление для этого?

Пожалуйста, помогите мне, ребята, спасибо.

Related of "Как отобразить заголовок таблицы на каждой странице с помощью библиотеки FPDF?"