HTML Таблица в PDF - PullRequest
       4

HTML Таблица в PDF

0 голосов
/ 03 апреля 2020

Я пытаюсь напечатать HTML таблицу в PDF, используя JSPdf . В моей таблице 20 столбцов. Из-за этого я не смог распечатать всю таблицу. Последний 4-6 столбец всегда скрыт. Есть ли какой-либо способ сделать видимым или сбить скрытый контент?

HTML

<div class="table-responsive" >
      <table class="table table-bordered">
        <thead>
          <tr>
            <th>Year Lease</th>
            <th>user Name</th>
            <th>Total Rent</th>
            <th>Other Income</th>
            <th>Total Income</th>
            <th>Avg Expenses at 4 %</th>
            <th>Value Added Expense</th>
            <th>Other Expense</th>
            <th>Total Expense</th>
            <th>NOI</th>
            <th>CAP Rate</th>
            <th>Interest Paid</th>
            <th>Net Income</th>
            <th>Principal</th>
            <th>Yearly Cashflow</th>
            <th>Yearly</th>
            <th>DS Ratio</th>
          </tr>
        </thead>
        <tbody *ngFor="let userInfo of user;index as i">
          <tr>
            <td>Year {{i+1}} Leased</td>
            <td *ngFor="let user of  userInfo.user">{{user.amount | currency}}</td>
            <td>{{user.grossIncome | currency}}</td>
            <td>{{user.otherIncome | currency }}</td>
            <td>{{user.totalIncome | currency }}</td>
            <td>{{user.totalExpense}}</td>
            <td>{{user.valueAddedExpense | currency}}</td>
            <td>{{user.otherExpense  | currency}}</td>
            <td>{{user.totalExpense  | currency}}</td>
            <td>{{user.netOperatingIncome  | currency}}</td>
            <td>{{user.capRate}}% </td>
            <td>{{user.mortageInterest  | currency}}</td>
            <td>{{user.netIncome  | currency}}</td>
            <td>{{user.principle  | currency}}</td>
            <td>{{user.yearlyCashFlow  | currency}}</td>
            <td>{{user.yearly}} %</td>
            <td>{{user.deptServiceRatio}} %</td>
          </tr>
        </tbody>
      </table>
    </div>

TS

 var pdf = new jsPDF('p','pt', 'a3');
    pdf.internal.scaleFactor = 1.40;
    pdf.addHTML(this.print.nativeElement, 0, 0, {
      pagesplit: true
    },  ()=> {
      pdf.save('Report-' + new Date() + '.pdf');
    });

Выпуск

enter image description here

Еще 4 столбца осталось после CAP Rate. Пожалуйста, помогите мне

1 Ответ

0 голосов
/ 03 апреля 2020

Y должен установить вашу высоту PDF следующим образом:

      var width = pdf.internal.pageSize.getWidth();    
      var height = pdf.internal.pageSize.getHeight();
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...