diff --git a/types/index.d.ts b/types/index.d.ts index 78543dc0c..fd45e9e1f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -169,10 +169,15 @@ declare module "jspdf" { ): HTMLWorker; progress: HTMLWorkerProgress; error(msg: string): void; - save(filename: string): void; + save(filename: string): Promise; set(opt: HTMLOptions): HTMLWorker; get(key: "string"): HTMLWorker; get(key: "string", cbk: (value: string) => void): string; + doCallback(): Promise; + outputImg( + type: "img" | "datauristring" | "dataurlstring" | "datauri" | "dataurl" + ): Promise; + outputPdf: jsPDF["output"]; } export interface HTMLOptionImage { @@ -502,6 +507,19 @@ declare module "jspdf" { | "Separation" | "DeviceN"; + export type ImageFormat = + | "RGBA" + | "UNKNOWN" + | "PNG" + | "TIFF" + | "JPG" + | "JPEG" + | "JPEG2000" + | "GIF87a" + | "GIF89a" + | "WEBP" + | "BMP"; + export interface ImageOptions { imageData: | string @@ -516,6 +534,7 @@ declare module "jspdf" { alias?: string; compression?: ImageCompression; rotation?: number; + format?: ImageFormat; } export interface ImageProperties { alias: number; @@ -531,6 +550,7 @@ declare module "jspdf" { predictor?: number; index: number; data: string; + fileType: ImageFormat; } export interface TextOptionsLight { @@ -1077,7 +1097,7 @@ declare module "jspdf" { ): void; // jsPDF plugin: html - html(src: string | HTMLElement, options?: HTMLOptions): Promise; + html(src: string | HTMLElement, options?: HTMLOptions): HTMLWorker; // jsPDF plugin: JavaScript addJS(javascript: string): jsPDF;