Skip to content

Commit 5734314

Browse files
authored
[pdfmake] Update to 0.3, add new properties (DefinitelyTyped#74337)
1 parent f8764c2 commit 5734314

15 files changed

+471
-108
lines changed

types/html-to-pdfmake/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
],
88
"dependencies": {
99
"@types/jsdom": "*",
10-
"@types/pdfmake": "*"
10+
"@types/pdfmake": "^0.2.0"
1111
},
1212
"devDependencies": {
1313
"@types/html-to-pdfmake": "workspace:."

types/jsx-pdf/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"https://github.com/schibsted/jsx-pdf#readme"
77
],
88
"dependencies": {
9-
"@types/pdfmake": "*"
9+
"@types/pdfmake": "^0.2.0"
1010
},
1111
"devDependencies": {
1212
"@types/jsx-pdf": "workspace:.",

types/pdfmake/build/pdfmake.d.ts

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1 @@
1-
/// <reference lib="dom" />
2-
import { BufferOptions, CustomTableLayout, TDocumentDefinitions, TFontDictionary } from "../interfaces";
3-
4-
export let vfs: { [file: string]: string };
5-
export let fonts: TFontDictionary;
6-
export let tableLayouts: { [name: string]: CustomTableLayout };
7-
8-
export function createPdf(
9-
documentDefinitions: TDocumentDefinitions,
10-
tableLayouts?: { [name: string]: CustomTableLayout },
11-
fonts?: TFontDictionary,
12-
vfs?: { [file: string]: string },
13-
): TCreatedPdf;
14-
15-
export interface TCreatedPdf {
16-
download(cb?: () => void, options?: BufferOptions): void;
17-
download(defaultFileName: string, cb?: () => void, options?: BufferOptions): void;
18-
19-
getBlob(cb: (result: Blob) => void, options?: BufferOptions): void;
20-
getBase64(cb: (result: string) => void, options?: BufferOptions): void;
21-
getBuffer(cb: (result: Buffer) => void, options?: BufferOptions): void;
22-
getDataUrl(cb: (result: string) => void, options?: BufferOptions): void;
23-
getStream(options?: BufferOptions): PDFKit.PDFDocument; // minimal version 0.1.41
24-
open(options?: BufferOptions, win?: Window | null): void;
25-
print(options?: BufferOptions, win?: Window | null): void;
26-
}
27-
28-
export as namespace pdfMake;
1+
export * from "../index";
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
/// <reference lib="dom" />
2-
3-
import { createPdf, fonts, tableLayouts, TCreatedPdf, vfs } from "./pdfmake";
4-
5-
export { createPdf, fonts, tableLayouts, TCreatedPdf, vfs };
1+
export * from "../index";

types/pdfmake/build/vfs_fonts.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
declare const vfs: { [file: string]: string };
1+
import { TVirtualFileSystem } from "../interfaces";
2+
3+
declare const vfs: TVirtualFileSystem;
24

35
export = vfs;

types/pdfmake/index.d.ts

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,40 @@
1-
/// <reference types="pdfkit" />
1+
import {
2+
BufferOptions,
3+
CustomTableLayout,
4+
ProgressCallback,
5+
TCreatedPdf,
6+
TDocumentDefinitions,
7+
TFontContainer,
8+
TFontDictionary,
9+
TVirtualFileSystem,
10+
} from "./interfaces";
211

3-
import { BufferOptions, TDocumentDefinitions, TFontDictionary } from "./interfaces";
12+
export type { TCreatedPdf };
413

5-
declare class PdfPrinter {
6-
constructor(fontDescriptors: TFontDictionary);
7-
createPdfKitDocument(docDefinition: TDocumentDefinitions, options?: BufferOptions): PDFKit.PDFDocument;
8-
}
14+
export function createPdf(
15+
documentDefinitions: TDocumentDefinitions,
16+
options?: BufferOptions,
17+
): TCreatedPdf;
918

10-
export = PdfPrinter;
19+
export function setProgressCallback(callback: ProgressCallback): void;
20+
21+
export function addTableLayouts(tableLayouts: Record<string, CustomTableLayout>): void;
22+
export function setTableLayouts(tableLayouts: Record<string, CustomTableLayout>): void;
23+
export function clearTableLayouts(): void;
24+
25+
export let fonts: TFontDictionary;
26+
export function addFonts(fonts: TFontDictionary): void;
27+
export function setFonts(fonts: TFontDictionary): void;
28+
export function clearFonts(): void;
29+
30+
/**
31+
* **Note:** Only supported in the browser.
32+
*/
33+
export function addVirtualFileSystem(vfs: TVirtualFileSystem): void;
34+
35+
/**
36+
* **Note:** Only supported in the browser.
37+
*/
38+
export function addFontContainer(fontContainer: TFontContainer): void;
39+
40+
export as namespace pdfMake;

0 commit comments

Comments
 (0)