diff --git a/types/main.d.ts b/types/main.d.ts index eb7e7eb..0724dc6 100644 --- a/types/main.d.ts +++ b/types/main.d.ts @@ -91,7 +91,20 @@ declare module "pdfjs" { * Can be used to render the document as a buffer * @param callback callback called with either error or buffer */ - asBuffer(callback?: (err: Error, data: Buffer) => void): void; + asBuffer(callback: (err: Error, data: Buffer) => void): Promise; + + /** + * Can be used to render the document as a buffer + * @param opts can be used to control if the document will automatically be ended + */ + asBuffer(opts: AsBufferOptions): Promise; + + /** + * Can be used to render the document as a buffer + * @param opts can be used to control if the document will automatically be ended + * @param callback callback called with either error or buffer + */ + asBuffer(opts: AsBufferOptions, callback: (err: Error, data: Buffer) => void): Promise; /** * Add a header to the document @@ -132,6 +145,8 @@ declare module "pdfjs" { outline(title: string, destination: string, parent?: string | number): void; } + type AsBufferOptions = { end: boolean }; + export class Fragment { end(): void; // TODO