Skip to content

Commit 40d832f

Browse files
committed
✨feat: you can now resize getSnapshot #3032
1 parent 4567de3 commit 40d832f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/api/Client.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2120,9 +2120,13 @@ public async testCallback(callbackToTest: SimpleListener, testData: any) : Prom
21202120

21212121
/**
21222122
* Returns a PNG DataURL screenshot of the session
2123+
* @param chatId Chat ID to open before taking a snapshot
2124+
* @param width Width of the viewport for the snapshot. Height also required if you want to resize.
2125+
* @param height Height of the viewport for the snapshot. Width also required if you want to resize.
21232126
* @returns `Promise<DataURL>`
21242127
*/
2125-
public async getSnapshot(chatId?: ChatId) : Promise<DataURL> {
2128+
public async getSnapshot(chatId ?: ChatId, width ?: number, height ?: number) : Promise<DataURL> {
2129+
if(width && height) await this.resizePage(width,height)
21262130
const snapshotElement = chatId ? (await this._page.evaluateHandle(
21272131
({ chatId }) => WAPI.getSnapshotElement(chatId),
21282132
{ chatId }

0 commit comments

Comments
 (0)