Files
sam-hotfix/research/ppt_team_agent-main/jocoding-pptx-converter.js
김보곤 d86b5851d0 chore: 프로젝트 설정 및 문서 파일 추가
- .agent/, .claude/, .vscode/ 설정 파일
- design/ 디자인 리소스
- reports/, research/ 분석 문서
- testcase/ 테스트 케이스 문서
- db_sync_chandj.bat, sam.code-workspace

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 19:51:43 +09:00

85 lines
2.6 KiB
JavaScript

/**
* 조코딩 HTML 슬라이드를 PPTX로 변환하는 스크립트 (깨끗한 버전)
* Skills 폴더의 html2pptx.js 기술을 사용
*/
const html2pptx = require('./.claude/skills/pptx-skill/scripts/html2pptx.js');
const pptxgen = require('pptxgenjs');
const fs = require('fs');
async function convertJoCodingSlides() {
console.log('🎬 조코딩 프레젠테이션 변환을 시작합니다...');
console.log('📊 총 12장의 슬라이드를 변환합니다.');
const pres = new pptxgen();
pres.layout = 'LAYOUT_16x9';
pres.author = '조코딩 프레젠테이션';
pres.title = '조코딩(조웅현) - 국내 1위 코딩 교육 유튜버';
let successCount = 0;
let errorCount = 0;
// 12장의 슬라이드 변환
for (let i = 1; i <= 12; i++) {
const slideNum = i.toString().padStart(2, '0');
const htmlFile = `slides/jocoding-slide-${slideNum}.html`;
if (!fs.existsSync(htmlFile)) {
console.warn(`⚠️ 파일 없음: ${htmlFile}`);
continue;
}
console.log(`🔄 변환 중: 슬라이드 ${i}/12 (${htmlFile})`);
try {
// Skills의 html2pptx 기술 사용
const { slide, placeholders } = await html2pptx(htmlFile, pres);
successCount++;
console.log(`✅ 완료: 슬라이드 ${i}`);
if (placeholders && placeholders.length > 0) {
console.log(`📍 플레이스홀더 ${placeholders.length}개 발견`);
}
} catch (error) {
errorCount++;
console.error(`❌ 실패: 슬라이드 ${i} - ${error.message}`);
// 실패시 기본 슬라이드 생성
const errorSlide = pres.addSlide();
errorSlide.addText(`슬라이드 ${i}`, {
x: 1, y: 2, w: 8, h: 1,
fontSize: 28, fontFace: 'Malgun Gothic',
color: '333333', bold: true, align: 'center'
});
errorSlide.addText('변환 중 오류 발생', {
x: 1, y: 3, w: 8, h: 1,
fontSize: 16, fontFace: 'Malgun Gothic',
color: '666666', align: 'center'
});
}
}
// PPTX 파일 저장
const fileName = '조코딩_프레젠테이션_12장_최종.pptx';
await pres.writeFile({ fileName });
console.log(`\n🎉 변환 완료!`);
console.log(`📄 파일: ${fileName}`);
console.log(`📊 결과: ${pres.slides.length}개 슬라이드 (성공: ${successCount}, 오류: ${errorCount})`);
if (successCount === 12) {
console.log(`🌟 모든 슬라이드가 성공적으로 변환되었습니다!`);
}
}
// 실행
convertJoCodingSlides()
.then(() => {
console.log('✨ 모든 작업이 완료되었습니다.');
})
.catch(error => {
console.error('💥 변환 중 오류:', error.message);
process.exit(1);
});