|
| 1 | +declare module "html2pdf.js" { |
| 2 | + interface Html2PdfOptions { |
| 3 | + margin?: number | [number, number] | [number, number, number, number]; |
| 4 | + filename?: string; |
| 5 | + image?: { |
| 6 | + type?: "jpeg" | "png" | "webp"; |
| 7 | + quality?: number; |
| 8 | + }; |
| 9 | + enableLinks?: boolean; |
| 10 | + html2canvas?: object; |
| 11 | + jsPDF?: { |
| 12 | + unit?: string; |
| 13 | + format?: string | [number, number]; |
| 14 | + orientation?: "portrait" | "landscape"; |
| 15 | + }; |
| 16 | + } |
| 17 | + |
| 18 | + interface Html2PdfWorker { |
| 19 | + from(src: HTMLElement | string | HTMLCanvasElement | HTMLImageElement): this; |
| 20 | + to(target: "container" | "canvas" | "img" | "pdf"): this; |
| 21 | + toContainer(): this; |
| 22 | + toCanvas(): this; |
| 23 | + toImg(): this; |
| 24 | + toPdf(): this; |
| 25 | + output(type?: string, options?: any, src?: "pdf" | "img"): Promise<any>; |
| 26 | + outputPdf(type?: string, options?: any): Promise<any>; |
| 27 | + outputImg(type?: string, options?: any): Promise<any>; |
| 28 | + save(filename?: string): Promise<void>; |
| 29 | + set(options: Html2PdfOptions): this; |
| 30 | + get(key: string, cbk?: (value: any) => void): Promise<any>; |
| 31 | + then<T>(onFulfilled?: (value: any) => T | PromiseLike<T>, onRejected?: (reason: any) => any): Promise<T>; |
| 32 | + thenCore<T>(onFulfilled?: (value: any) => T | PromiseLike<T>, onRejected?: (reason: any) => any): Promise<T>; |
| 33 | + thenExternal<T>(onFulfilled?: (value: any) => T | PromiseLike<T>, onRejected?: (reason: any) => any): Promise<T>; |
| 34 | + catch<T>(onRejected?: (reason: any) => T | PromiseLike<T>): Promise<T>; |
| 35 | + catchExternal<T>(onRejected?: (reason: any) => T | PromiseLike<T>): Promise<T>; |
| 36 | + error(msg: string): void; |
| 37 | + } |
| 38 | + |
| 39 | + interface Html2PdfStatic { |
| 40 | + (): Html2PdfWorker; |
| 41 | + new (): Html2PdfWorker; |
| 42 | + (element: HTMLElement, options?: Html2PdfOptions): Promise<void>; |
| 43 | + new (element: HTMLElement, options?: Html2PdfOptions): Promise<void>; |
| 44 | + Worker: new () => Html2PdfWorker; |
| 45 | + } |
| 46 | + |
| 47 | + const html2pdf: Html2PdfStatic; |
| 48 | + export default html2pdf; |
| 49 | +} |
0 commit comments