From ef75dbbb61c39f58be449fb547912999320ca494 Mon Sep 17 00:00:00 2001 From: sauravniraula Date: Wed, 14 May 2025 03:16:21 +0545 Subject: [PATCH] Fixes: export handler ipc --- app/ipc/export_handlers.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/ipc/export_handlers.ts b/app/ipc/export_handlers.ts index 4d8e0a50..bfb6a03d 100644 --- a/app/ipc/export_handlers.ts +++ b/app/ipc/export_handlers.ts @@ -1,8 +1,7 @@ import { BrowserWindow, ipcMain, } from "electron"; -import { baseDir, downloadsDir, isDev } from "../utils/constants"; +import { baseDir, downloadsDir } from "../utils/constants"; import fs from "fs"; import path from "path"; -import puppeteer from "puppeteer"; import { showFileDownloadedDialog } from "../utils/dialog"; export function setupExportHandlers() { @@ -29,8 +28,14 @@ export function setupExportHandlers() { show: false, }); browser.loadURL(ppt_url); + const success = await new Promise((resolve, _) => { - browser.webContents.on('did-frame-finish-load', async () => { + browser.webContents.on('did-finish-load', async () => { + // Wait for 1 second to make sure the page is loaded + await new Promise((resolve, _) => { + setTimeout(resolve, 1000); + }); + const pdfBuffer = await browser.webContents.printToPDF({ printBackground: true, pageSize: { width: 1280 / 96, height: 720 / 96 },