-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
71 lines (65 loc) · 1.97 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
declare module 'better-html-pdf';
/**
* Convert a html string or website to a pdf file
* @param {*} html html string
* @param {*} options options object, defaults are respected
* @returns PDF file content as ``[base64 | buffer]``
*/
export declare function html2pdf(html: string, options: PdfOptions): Promise<string> | Promise<Buffer>;
/**
* Write a base64 encoded pdf to a pdf file. Path must exist.
* @param {*} fileContent pdf file content as b64 string
* @param {*} file path to write the file to, absolute or relative
*/
export declare function base64ToPdf(fileContent: string, file: string): void;
/**
* Write a buffer to a pdf file. Path must exist.
* @param {*} fileContent pdf file content as buffer
* @param {*} file path to write the file to, absolute or relative
*/
export declare function bufferToPdf(fileContent: Buffer, file: string): void;
/**
* All options that can be passed to the converter
*/
export declare interface PdfOptions {
fileType?: FileType,
url?: string,
viewPort?: string,
timeout?: number,
landscape?: boolean,
format?: PageFormat,
repeatTableHeader?: boolean,
repeatTableFooter?: boolean,
displayHeaderFooter?: boolean,
headerTemplate?: string,
footerTemplate?: string,
width?: number | string,
height?: number | string,
marginTop?: number | string,
marginBottom?: number | string,
marginLeft?: number | string,
marginRight?: number | string,
breakImages?: boolean,
avoidTableRowBreak?: boolean,
avoidDivbreak?: boolean,
omitBackground?: boolean,
pageRanges?: string,
path?: string,
disableJavascript?: boolean,
preferCSSPageSize?: boolean,
printBackground?: boolean,
trueColors?: boolean,
scale?: number,
screenMedia?: boolean
}
export declare enum PageFormat{
letter = 'letter',
legal = 'legal',
tabloid = 'tabloid',
a0 = 'a0',
a1 = 'a1',
a2 = 'a2',
a3= 'a3',
a4 = 'a4'
}
export type FileType = 'buffer' | 'base64';