2017-09-20 10 views
1

jsPDF를 가져올 수 있었지만 jspdf-autotable의 autoTable 메서드를 사용할 수 없습니다. jsPDF의 종속성으로 가져 오는 방법을 모르겠습니다. 위의 논의에서 추출Angles 4에서 jspdf-autotable을 사용하는 방법?

import { Injectable, Component } from '@angular/core'; 

import * as jsPDF from 'jspdf'; 
import { autoTable } from 'jspdf-autotable'; 

@Injectable() 
export class PdfService { 

    constructor() { 

    } 

    convertJsonToPdf(columns: any, jsonData: any) { 
     var doc = new jsPDF('p', 'pt'); // OK, created 
     doc.autoTable(columns, jsonData); // Fails because autoTable is not in doc 
    } 
} 
+1

시도로

import { autoTable } from 'jspdf-autotable'; 

을;'와' import 'jspdf-autotable';'; –

+0

@ SimonBengtsson 잘 했어, 고마워. – user1916077

답변

3

,이 라인 교체 'jspdf-autotable'에서이 라인`수입 {autoTable}을 (를) 대체 할

import 'jspdf-autotable'; 
+0

각도 2는 어떻습니까? 가져 오기 'jspdf-autotable'; 또는 'jspdf-autotable'에서 {autoTable}을 가져 오십시오. 아무것도 작동하지 않습니다 – Deep

+0

'import 'jspdf-autotable';'작동해야합니다. 그것이 당신을 위해 작동하지 않는다면 더 많은 정보와 함께 새로운 질문을 작성하십시오. –

+0

https://stackoverflow.com/questions/47344349/property-autotable-does-not-exist-on-type-jspdf 정확한 질문입니다. – Deep