From 3c2a4dda5eed89ba64b2edd32eb396dade5fff15 Mon Sep 17 00:00:00 2001 From: Pavithran Gridharan Date: Thu, 25 Apr 2019 23:43:33 +0200 Subject: [PATCH] feat: update pdfmake (#34830) --- types/pdfmake/index.d.ts | 44 +++++++++++++++++++++++++++++++------ types/pdfmake/tsconfig.json | 1 + 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/types/pdfmake/index.d.ts b/types/pdfmake/index.d.ts index 8ec939a588..ed6e69cb6f 100644 --- a/types/pdfmake/index.d.ts +++ b/types/pdfmake/index.d.ts @@ -16,7 +16,7 @@ declare module 'pdfmake/build/vfs_fonts' { declare module 'pdfmake/build/pdfmake' { let vfs: TFontFamily; let fonts: { [name: string]: TFontFamilyTypes }; - function createPdf(documentDefinitions: TDocumentDefinitions): TCreatedPdf; + function createPdf(documentDefinitions: TDocumentDefinitions, tableLayouts?: any, fonts?: any, vfs?: any): TCreatedPdf; enum PageSize { A0_x_4 = '4A0', @@ -183,16 +183,46 @@ declare module 'pdfmake/build/pdfmake' { defaultStyle?: Style; } - type CreatedPdfParams = ( + interface Pagesize { + height: number; + width: number; + orientation: PageOrientation; + } + + interface Page { + items: any[]; + pageSize: Pagesize; + } + + interface BufferOptions { + autoPrint?: boolean; + } + + type CreatedPdfDownloadParams = ( defaultFileName?: string, - cb?: string, - options?: string + cb?: () => void, + options?: BufferOptions, + ) => void; + + type CreatedPdfOpenPrintParams = ( + options?: BufferOptions, + win?: Window | null, + ) => void; + + type CreatedPdfBufferParams = ( + cb: (result: any, pages: Page[]) => void, + options?: BufferOptions, ) => void; interface TCreatedPdf { - download: CreatedPdfParams; - open: CreatedPdfParams; - print: CreatedPdfParams; + download: CreatedPdfDownloadParams; + getBlob: CreatedPdfBufferParams; + getBase64: CreatedPdfBufferParams; + getBuffer: CreatedPdfBufferParams; + getDataUrl: CreatedPdfBufferParams; + getStream: CreatedPdfBufferParams; // minimal version 0.1.41 + open: CreatedPdfOpenPrintParams; + print: CreatedPdfOpenPrintParams; } interface pdfMakeStatic { diff --git a/types/pdfmake/tsconfig.json b/types/pdfmake/tsconfig.json index 2e8b5b10af..e7bc0edbf6 100644 --- a/types/pdfmake/tsconfig.json +++ b/types/pdfmake/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ + "dom", "es6" ], "noImplicitAny": true,