$Bottom_Margin = 30;
 $Left_Margin = 40;
 $Right_Margin = 30;
 $pdf = new Cpdf('P', 'pt', 'A4');
 $pdf->addInfo('Author', 'webERP ' . $Version);
 $pdf->addInfo('Creator', 'webERP http://www.weberp.org');
 if ($InvOrCredit == 'Invoice') {
     $pdf->addInfo('Title', _('Sales Invoice') . ' ' . $FromTransNo . ' to ' . $_POST['ToTransNo']);
     $pdf->addInfo('Subject', _('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']);
 } else {
     $pdf->addInfo('Title', _('Sales Credit Note'));
     $pdf->addInfo('Subject', _('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']);
 }
 $pdf->setAutoPageBreak(0);
 $pdf->setPrintHeader(false);
 $pdf->setPrintFooter(false);
 $pdf->AddPage();
 $pdf->cMargin = 0;
 $FirstPage = true;
 $line_height = 16;
 //Keep a record of the user's language
 $UserLanguage = $_SESSION['Language'];
 while ($FromTransNo <= filter_number_format($_POST['ToTransNo'])) {
     /*retrieve the invoice details from the database to print
     	notice that salesorder record must be present to print the invoice purging of sales orders will
     	nobble the invoice reprints */
     // check if the user has set a default bank account for invoices, if not leave it blank
     $sql = "SELECT bankaccounts.invoice,\n\t\t\t\t\tbankaccounts.bankaccountnumber,\n\t\t\t\t\tbankaccounts.bankaccountcode\n\t\t\t\tFROM bankaccounts\n\t\t\t\tWHERE bankaccounts.invoice = '1'";
     $result = DB_query($sql, '', '', false, false);
     if (DB_error_no() != 1) {
         if (DB_num_rows($result) == 1) {