-
Notifications
You must be signed in to change notification settings - Fork 61
/
index.d.ts
99 lines (88 loc) · 1.9 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
declare module 'pdfkit-table'
{
import PDFDocument from 'pdfkit';
interface Rect {
x: number;
y: number;
width: number;
height: number;
}
interface Header {
label?: string;
property?: string;
width?: number;
align?: string; //default 'left'
valign?: string;
headerColor?: string; //default '#BEBEBE'
headerOpacity?: number; //default '0.5'
headerAlign?: string; //default 'left'
columnColor?: string;
columnOpacity?: number;
renderer?: (
value: any,
indexColumn?: number,
indexRow?: number,
row?: number,
rectRow?: Rect,
rectCell?: Rect
) => string;
}
interface DataOptions {
fontSize: number;
fontFamily: string;
separation: boolean;
}
interface Data {
[key: string]: string | { label: string; options?: DataOptions };
}
interface Table {
title?: string;
subtitle?: string;
headers?: (string | Header)[];
datas?: Data[];
rows?: string[][];
}
interface DividerOptions {
disabled?: boolean;
width?: number;
opacity?: number;
}
interface Divider {
header?: DividerOptions;
horizontal?: DividerOptions;
}
interface Title
{
label: string;
fontSize?: number;
fontFamily?: string;
color?: string;
}
interface Options {
title?: string | Title ;
subtitle?: string | Title;
width?: number;
x?: number; //default doc.x
y?: number; //default doc.y
divider?: Divider;
columnsSize?: number[];
columnSpacing?: number; //default 5
padding?: number[];
addPage?: boolean; //default false
hideHeader?: boolean;
minRowHeight?: number;
prepareHeader?: () => PDFDocumentWithTables;
prepareRow?: (
row?: any,
indexColumn?: number,
indexRow?: number,
rectRow?: Rect,
rectCell?: Rect
) => PDFDocumentWithTables;
}
class PDFDocumentWithTables extends PDFDocument {
public table(table: Table, options?: Options): Promise<void>;
}
// export = PDFDocumentWithTables;
export default PDFDocumentWithTables;
}