// 로컬 node_modules 경로 추가 const path = require('path'); module.paths.unshift(path.join(__dirname, 'node_modules')); const PptxGenJS = require('pptxgenjs'); const html2pptx = require('C:/Users/aweso/.claude/skills/pptx-skill/scripts/html2pptx.js'); const fs = require('fs'); async function main() { const pres = new PptxGenJS(); // 16:9 비율 설정 (720pt × 405pt = 10" × 5.625") // LAYOUT_WIDE는 13.3" × 7.5"이므로 커스텀 레이아웃 사용 pres.defineLayout({ name: 'CUSTOM_16x9', width: 10, height: 5.625 }); pres.layout = 'CUSTOM_16x9'; // 프레젠테이션 메타데이터 pres.title = 'SAM_ERP Storyboard'; pres.subject = 'SAM ERP 스토리보드 D1.2'; pres.author = 'CODE-BRIDGE X'; pres.company = 'SAM'; const slidesDir = path.join(__dirname, 'slides'); // 슬라이드 파일 목록 (순서대로) const slideFiles = [ 'slide-01-cover.html', 'slide-02-history.html', 'slide-03-menu.html', 'slide-04-section-common.html', 'slide-05-interaction.html', 'slide-06-responsive.html', 'slide-07-section-operation.html', 'slide-08-flowchart.html', 'slide-09-login.html' ]; let successCount = 0; let failCount = 0; const errors = []; console.log('SAM_ERP Storyboard PPTX 변환 시작...\n'); for (const slideFile of slideFiles) { const slidePath = path.join(slidesDir, slideFile); if (!fs.existsSync(slidePath)) { console.log(`⚠️ ${slideFile}: 파일 없음`); failCount++; errors.push({ file: slideFile, error: '파일 없음' }); continue; } try { console.log(`🔄 ${slideFile} 변환 중...`); await html2pptx(slidePath, pres); console.log(`✅ ${slideFile} 완료`); successCount++; } catch (error) { console.log(`❌ ${slideFile}: ${error.message}`); failCount++; errors.push({ file: slideFile, error: error.message }); } } console.log('\n========================================'); console.log(`변환 결과: ${successCount}개 성공, ${failCount}개 실패`); if (errors.length > 0) { console.log('\n실패한 슬라이드:'); errors.forEach(({ file, error }) => { console.log(` - ${file}: ${error.substring(0, 100)}${error.length > 100 ? '...' : ''}`); }); } // PPTX 저장 const outputDir = path.join(__dirname, 'pptx'); if (!fs.existsSync(outputDir)) { fs.mkdirSync(outputDir, { recursive: true }); } const outputPath = path.join(outputDir, 'SAM_ERP_Storyboard_v2.pptx'); try { await pres.writeFile({ fileName: outputPath }); console.log(`\n📁 PPTX 저장 완료: ${outputPath}`); } catch (error) { console.error(`\n❌ PPTX 저장 실패: ${error.message}`); } } main().catch(console.error);