我正在尝试根据 Angular 11 应用程序中 pdfMake 的官方文档定义 pdf 文档结构。但收到错误:
error TS2345: Argument of type '{ pageSize: string; pageOrientation: string; content: ({ text: string; style: string; fontSize?: undefined; } | { text: string; fontSize: number; style?: undefined; })[]; }' is not assignable to parameter of type 'TDocumentDefinitions'.
Types of property 'pageOrientation' are incompatible.
Type 'string' is not assignable to type '"landscape" | "portrait" | undefined'.
75 pdfMake.createPdf(docDefinition).open();
Run Code Online (Sandbox Code Playgroud)
我已经安装了所有人员:
npm install --save pdfmake
npm i --save-dev @types/pdfmake
Run Code Online (Sandbox Code Playgroud)
并导入它们:
import * as pdfMake from …Run Code Online (Sandbox Code Playgroud)