$pdf->Cell(20, 6, TABLE_HEADING_TOTAL_EXCLUDING_TAX, 1, 0, 'C', 1);
    $pdf->SetX(185);
    $pdf->Cell(18, 6, TABLE_HEADING_TOTAL_INCLUDING_TAX, 1, 0, 'C', 1);
    $pdf->Ln();
}
output_table_heading($Y_Fields_Name_position);
// Rechnungsaufgliederung nach Positionen
$line_counter = 0;
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
    if ($line_counter + sizeof($order->products[$i]['attributes']) >= 20) {
        $pdf->AddPage();
        // Position der Feldnamen auf den Folgeseiten
        $Y_Fields_Name_position = 125;
        // Tabellenposition under den Feldnamen
        $Y_Table_Position = 70;
        output_table_heading($Y_Table_Position - 6);
        $line_counter = 0;
    }
    $border = 'LTR';
    if (sizeof($order->products[$i]['attributes']) == 0) {
        $border = 1;
    }
    $pdf->SetFont('Arial', '', 7);
    $pdf->SetY($Y_Table_Position);
    $pdf->SetX(20);
    //$temp = str_replace('&nbsp;', ' ');
    $pdf->MultiCell(10, 6, $order->products[$i]['qty'] . 'x', $border, 'C');
    $pdf->SetY($Y_Table_Position);
    $pdf->SetX(55);
    if (strlen($order->products[$i]['name']) > 40 && strlen($order->products[$i]['name']) < 45) {
        $pdf->SetFont('Arial', '', 7);
     $order->products[$i]['name'] = str_replace("</b>", '', $order->products[$i]['name']);
     $pdf->MultiCell(148, $lineheight, $order->products[$i]['name'] . $prodattrstr, 1, 'L');
     $pdf->SetY($Y_Table_Position);
     $pdf->SetX(178);
     $pdf->SetFont('Arial', '', 7);
     $pdf->MultiCell(25, $rowheight, $order->products[$i]['model'], 1, 'C');
     $Y_Table_Position += $rowheight;
     //Check for product line overflow
     $item_count++;
     if (is_long($item_count / 32) && $i >= 20 || $i == 20) {
         $pdf->AddPage();
         //Fields Name position
         $Y_Fields_Name_position = 125;
         //Table position, under Fields Name
         $Y_Table_Position = 70;
         output_table_heading($Y_Table_Position - $rowheight);
         if ($i == 20) {
             $item_count = 1;
         }
     }
 }
 $Y_Table_Position += 12;
 if ($Y_Table_Position > 240) {
     $pdf->AddPage();
     $Y_Table_Position = 70;
 }
 // Strich vor Rechnungstext2
 $pdf->SetFont('Arial', 'B', 8);
 $pdf->SetTextColor(0);
 $pdf->SetY($Y_Table_Position);
 $pdf->SetX(20);