Skip to content

Commit

Permalink
Merge pull request #321 from tim-we/asbuffer-type-fix
Browse files Browse the repository at this point in the history
Fix Document.asBuffer types
  • Loading branch information
rkusa authored Dec 27, 2023
2 parents b6cdd70 + b46b431 commit 0dad900
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion types/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown>;

/**
* 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<Buffer>;

/**
* 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<unknown>;

/**
* Add a header to the document
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 0dad900

Please sign in to comment.