From 9fffc2162f12b9ad95dbb5cd33896acafd9c73bf Mon Sep 17 00:00:00 2001 From: lichaojun Date: Tue, 1 Oct 2024 18:59:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=B8=AA=E6=95=B0?= =?UTF-8?q?=E9=99=90=E5=88=B6=EF=BC=8C=E5=87=8F=E5=B0=91=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ppt_to_img.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ppt_to_img.js b/src/ppt_to_img.js index 144721e..d779bc8 100644 --- a/src/ppt_to_img.js +++ b/src/ppt_to_img.js @@ -45,19 +45,24 @@ const convertPdfToImg = (inputDir, file) => { }; // 读取输入目录下所有ppt文件 => 转换为pdf +let execNum = 0; fs.readdirSync(inputDir).forEach((file) => { const ext = file.split('.').pop().toLowerCase(); if (ppt.pptFormat.has(ext)) { + execNum++; + if (base.rangeNum && execNum > base.rangeNum) { + console.log(base.rangeNum, execNum, '跳过'); + return; + } + console.log(base.rangeNum, execNum, '执行'); + const inputPath = path.join(inputDir, file); convertPptToPdf(inputPath); } }); // 读取输入目录下所有pdf文件下所有pdf文件 => 转换为image -fs.readdirSync(pdfDir).forEach((file, index) => { - if (base.rangeNum && base.rangeNum > index + 1) { - return; - } +fs.readdirSync(pdfDir).forEach((file) => { const ext = file.split('.').pop().toLowerCase(); if (ppt.pdfFormat.has(ext)) { const inputPath = path.join(pdfDir, file);